483   PHP

1,php判断是否通过cli执行

if(php_sapi_name() == 'cli')
{
    //running from CLI
}

2,php判断脚本是否执行中


exec("ps -ef | grep shell_name | grep -v grep", $output, $result);
if(!empty($output) && count($output) > 0){
    echo "exist";
}




Leave a Reply

Your email address will not be published. Required fields are marked *