[英]Does php-cli even exist in command line options?
我正在嘗試使用shell_exec執行php文件thorugh php,這是代碼:
$ex="php -f ".rtrim(dirname(__FILE__))."/sendmail.php";
if(substr(php_uname(), 0, 7) == "Windows")
pclose(popen("start /B ".$ex,"r"));
else
shell_exec($ex." > /dev/null 2>/dev/null &");
問題是它在我的服務器上不起作用(我什至在沒有-f
情況下也嘗試過),但這沒關系:
$ex="php-cli ".rtrim(dirname(__FILE__))."/sendmail.php";
if(substr(php_uname(), 0, 7) == "Windows")
pclose(popen("start /B ".$ex,"r"));
else
shell_exec($ex." > /dev/null 2> /dev/null &");
有人可以告訴我為什么嗎? php-cli甚至存在嗎?
提前致謝
操作系統無關緊要。 如果未在php.ini
禁用shell_exec
則應該可以使用它
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.