将可执行文件输出保存到文件中



我正在通过php exec运行一个shell命令(它是一个网络抓取器)(虽然,我也尝试过系统和直通),我需要将结果保存在文件中,(最好是.txt),输出数据是一些HTML。它创建文件,但它始终为空。

请帮帮我。

下面是代码,我试图运行

file_put_contents('data.php',passthru('casperjs the_file_in_which_i_run.js',$output));

也尝试过

file_put_contents('data.php',exec('casperjs the_file_in_which_i_run.js',$output));

file_put_contents('data.php',system('casperjs the_file_in_which_i_run.js',$output));
exec(...., $output);
file_put_contents('file.txt', $output);

最新更新