我有一个我正在尝试运行的小脚本,但它在exec()
<pre><?php
ini_set("display_errors", 1);
$command = "wget --save-cookies cookies.txt \
--post-data '***' \
--keep-session-cookies \
http://site.com/ac_login.php;
wget --load-cookies cookies.txt \
--keep-session-cookies \
-p http://site.com/ac_landing.php;";
exec($command, $output) or die('fail');
foreach ($output as $num => $line) {
echo $num + 1 . ": " . $line . "\n";
}
?></pre>
如果我删除\
每行末尾的
1: wget: missing URL
2: Usage: wget [OPTION]... [URL]...
3:
4: Try `wget --help' for more options.
5: wget: missing URL
6: Usage: wget [OPTION]... [URL]...
7:
8: Try `wget --help' for more options.
我尝试将所有命令移到一行,但它又死了。我究竟做错了什么?如何检索此脚本中的错误?为结果添加第三个参数exec
返回空。
我用这个作为参考https://stackoverflow.com/a/1432161/763468
这些命令在 SSH 控制台中运行。