php 怎么判断是在命令行模式下运行呢
public function runningInConsole() { return php_sapi_name() == 'cli'; } public function runInCgi() { return strpos(php_sapi_name(), 'cgi', 0); }
public function runningInConsole() { return php_sapi_name() == 'cli'; } public function runInCgi() { return strpos(php_sapi_name(), 'cgi', 0); }