簡體   English   中英

sendfax php不工作,給代碼255

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM