我會提供一個例子 我想要的目錄列表寫入到文件 所以我這樣做如何編寫exec命令(在PHP中)輸出到文件?
<?php
$command="dir";
exec($command,$output);
//i want the directory list to be written to a file
// so i did this
$fp=fopen("file.txt","w");
fwrite($fp, $output);
//its actually writing the 0(return value for exec is int) to the file
// but i want the list of directories to be written to file
?>
其實際寫入0(回報EXEC值INT),該文件 但我想要目錄列表寫入文件 請告訴我一種方法來做到這一點
謝謝@AlexGidan。有用。 :) – user3737132
不客氣,很高興它幫助! –