1,使用方法 if (php_sapi_name() != "cli") { exit("only run in command line mode \n"); } 2 ,命令行执行结果 echo php_sapi_name();die;