如何从命令行运行php
我在CMD中这样做: php-f index.php 我希望在CMD中不断运行此代码,即使发生错误, 如何强制运行此命令?使用此命令如何从命令行运行php,php,command-line,cmd,window,command-prompt,Php,Command Line,Cmd,Window,Command Prompt,我在CMD中这样做: php-f index.php 我希望在CMD中不断运行此代码,即使发生错误, 如何强制运行此命令?使用此命令 ignore_user_abort(1); // Set whether a client disconnect should abort script execution set_time_limit(0); //Limits the maximum execution time, in this case it runs until the proces
ignore_user_abort(1); // Set whether a client disconnect should abort script execution
set_time_limit(0); //Limits the maximum execution time, in this case it runs until the process finishes or apache restart.
如果您想在应用程序崩溃或被故意中断的情况下重新运行该应用程序,则可以执行以下简单化操作:
@echo off
:endless
php -f index.php
goto endless
将其放入foo.cmd,然后运行foo如果您使用的是Linux服务器,则以下操作将起作用:
#!/bin/bash
while :
do
php index.php
done
通过运行sh./test.sh执行
窗户;以下作为.bat文件也可以使用
@echo off
cls
:start
php index.php
goto start