2012-07-30 62 views
2

我有一個php腳本,異步接受SOAP帖子並將重新格式化的信息轉發到另一個web服務。該職位最初提交給myPhpServer.php,那就是:爲什麼我的php腳本產生[filename] .php。[#]文件?

include('util.php'); 
$InvoiceNumber = (string)simplexml_load_string(file_get_contents("php://input"))->Order->InvoiceNumber; 
exec("wget -bqo /dev/null --post-data 'InvoiceNumber=$InvoiceNumber' http://mysite.com/auto/myPhp.php"); 

這是由myPhp.php,這沒有任何文件的寫入操作,除了在最後的時候我添加到我的日誌文件受理:

file_put_contents 
(
    'log.txt', 
    date('Y-M-j H:i:s T')."\t$InvoiceNumber\t".postToWebService($Order)."\n", 
    FILE_APPEND 
); 

此進程生成這個目錄叫myPhp.php在一個新的文件。[#],其中#從1開始,每次使用腳本的增量。因此,經過一段時間,這會形成一堆不可讀的0kb文件,如myPhp.php.1,myPhp.php.2,myPhp.php.3等等。我假定罪魁禍首是上面的東西,因爲其餘部分不讀取/寫入外部數據。任何線索通常會導致這種行爲,至少?

回答

4

你這樣做:

exec("wget -bqo /dev/null --post-data 'InvoiceNumber=$InvoiceNumber' http://mysite.com/auto/myPhp.php"); 

這確實寫入日誌(錯誤)消息到/ dev/null,但它檢索文件卡列斯myPhp.php,它使一個文件,一個的wget 。

閱讀wget的手冊頁,但我認爲您可以使用-O指定輸出文檔,就像您使用-o一樣。

相關問題