参考文章:
http://laravel-recipes.com/recipes/2/checking-if-youre-running-in-the-console
这里记一下:
laravel提供了一个方法:
APP::runningInCosole()
原理是通过:
php_sapi_name() == 'CLI"
PHP高版本,可能默认命令行为 'cli' ??又或者是linux下,不考虑windows,之前记得windows下,还有cgi,apachehandler等
本文介绍 Laravel 中用于检查应用程序是否在控制台运行的方法 APP::runningInConsole() 的使用及其实现原理。此方法通过 php_sapi_name() 函数判断当前 PHP 运行环境是否为 CLI 来确定。
参考文章:
http://laravel-recipes.com/recipes/2/checking-if-youre-running-in-the-console
这里记一下:
laravel提供了一个方法:
APP::runningInCosole()
原理是通过:
php_sapi_name() == 'CLI"
PHP高版本,可能默认命令行为 'cli' ??又或者是linux下,不考虑windows,之前记得windows下,还有cgi,apachehandler等
986

被折叠的 条评论
为什么被折叠?