【发布时间】:2014-02-16 08:50:33
【问题描述】:
我正在通过 php exec 运行一个 shell 命令(它是一个 web scraper)(尽管我也尝试过 system 和 passthru),我需要将结果保存在一个文件中,(最好是.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));
【问题讨论】: