簡體   English   中英

我如何不斷從命令行運行php

[英]how can I run php from command line constantly

我正在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 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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM