作者:
ZCBVXIRD (Alonso)
2015-09-21 13:00:11各位大大好
前幾天有問過背景執行的一下方法
目前是寫了 sample.php sample_background.php
這兩個來測試看行不行
code如下
[sample.php]
$cmd = "cmd /C D:\\software\\MAMP\\bin\\php\\php5.6.0\\php.exe
D:\\software\\MAMP\\htdocs\\test_background\\sample_background.php";
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run($cmd, 0, false);
[sample_background.php]
$file="sample_result.txt";
$fp = fopen($file,"a+");
fwrite($fp,"test OK! \r\n");
fclose($fp);
我從瀏覽器去開sample.php
希望能觸發sample_background.php 來寫入檔案
但是都沒有成功
但是把"cmd /C D:\\software\\MAMP\\bin\\php\\php5.6.0\\php.exe
D:\\software\\MAMP\\htdocs\\test_background\\sample_background.php"
這串複製到cmd內貼上跑 卻是可以的,代表這串command應該是沒有問題?
所以會是MAMP沒有這些function嗎?(要怎麼看有沒有這些module?)
還是有其他問題呢?
謝謝!