我有安裝了xampp的Windows 10。 假設我有一個PHP腳本,包含在Windows上的PHP - 檢查是否在後臺工作
set_time_limit(0);
ignore_user_abort(true);
$counter = 0;
while($counter < 60){
file_put_contents('runtime_log.txt', $counter." \r\n", FILE_APPEND);
$counter++;
sleep(1);
}
我可以關閉瀏覽器窗口和腳本還將被寫入輸出runtime_log.txt 如果我要檢查,如果它在後臺運行在Linux上,我會用
ps aux | grep php
如何在Windows上做同樣的事情?
編輯:我簡化了我的問題,因爲我可以看到它被誤解了。
[如何獲取運行PHP的操作系統?](https://stackoverflow.com/questions/1482260/how-to-get-the-os-on-which-php-is-運行) – Link
https://superuser.com/questions/18830/is-there-a-command-in-windows-like-ps-aux-in-unix你需要命令'tasklist' –
@vadim_hr我試過使用它,但它不顯示任何php.exe進程。 – Enri