我需要在 linux bash 中每秒运行 php cli。 您可以在下面找到我的 windows.bat 文件:
:loop
start /b pathTophp.exe pathTo\cycler.php
timeout /t 1
goto loop
也许我可以使用 cron 并每秒运行这个简单的脚本,但我假设分钟是最小间隔。
#!/bin/bash
php56 循环仪.php
据我所知,bash 中没有 goto,而且我根本不知道 bash。那我该怎么做呢?
最佳答案
你是对的 cron 只能去 1 分钟间隔,试试这个
#!/bin/bash
while true
do
php56 cycler.php
sleep 1
done
这将循环直到你用 ctrl-c 停止它
关于php - 在 bash 中循环 php 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39036785/