我一直在努力shell_exec PHP函數和在Linux命令2天。 要長話短說,這個工程:在shell_exec和at命令中使用wget?
shell_exec('/usr/bin/at 09:32 <<EOF
touch /var/www/website/hello.txt
EOF'
);
這並不:
shell_exec('/usr/bin/at 09:32 <<EOF
wget -O - -q -t 1 "http://192.168.56.101/website/test.php?param=hello" >/dev/null 2>&1
EOF'
);
爲什麼?
(注:上面的代碼不工作在控制檯)提前
感謝。
使用['file_get_contents'(http://php.net/manual/en/function.file-get-contents.php)代替wget的。而cron而不是'at'。 'shell_exec'應該被認爲是有害的,並且在一般情況下是最後的手段。 – OmnipotentEntity 2014-08-31 08:27:05
工作是否在'at'結束? (http://serverfault.com/questions/174678/how-do-i-print-contents-of-at-jobs) – GhostGambler 2014-08-31 08:30:55
'system_exec'調用的返回值是什麼? – GhostGambler 2014-08-31 08:31:12