[英]sendfax php not working, gives code 255
我試圖使用sendfax傳真,但它不會工作,當我回應我的exec聲明它工作正常...我的執行問題是什么?
$tmpfname = tempnam("/tmp", $_REQUEST['Email']);
$handle = fopen($tmpfname, "w");
fwrite($handle, $body);
fclose($handle);
exec('sendfax -n -d $to $tmpfname', $test2, $test3);
var_dump($test2);
echo $test3;
?>
我在頁面上得到的回復如下:
array(0) { } 255
謝謝你的幫助!
您正在使用沒有插值變量值的 'single quote strings'
。 嘗試更換:
exec('sendfax -n -d $to $tmpfname', $test2, $test3);
有:
exec("sendfax -n -d $to $tmpfname", $test2, $test3);
此外,您必須確定 $to
和$tmpfname
包含任何shell元字符。 目前, foo;rm -rf /&@example.com
的電子郵件地址foo;rm -rf /&@example.com
可能會刪除您關注的一些文件。 (我認為使用$_REQUEST['Email']
作為文件名的一部分是一個壞主意。)
請務必閱讀筆記在PHP exec()
文檔頁面。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.