从命令行执行时,如何阻止PHP返回标头?
发布时间:2020-12-13 16:01:30 所属栏目:PHP教程 来源:网络整理
导读:这可能是一个荒谬的问题,但它一直困扰着我. 我有一个邮件转发器管道传输到 PHP脚本,它收到完美,但我有以下错误邮寄给我立即: A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following
这可能是一个荒谬的问题,但它一直困扰着我.
我有一个邮件转发器管道传输到 PHP脚本,它收到完美,但我有以下错误邮寄给我立即: A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: pipe to |/home/[webroot]/public_html/external/mobile/email.php generated by mobile@[mydomain] The following text was generated during the delivery attempt: X-Powered-By: PHP/5.2.13 Content-type: text/html 正如您所看到的,Exim认为标题响应是我脚本的错误.该脚本可以完美地从php:// stdin接收电子邮件,但Exim快速回复错误. 加, >它从控制台运行,而不是Apache,所以HTAccess或配置Apache很可能什么都不做. 所以我的问题是:如何摆脱这两个标题? 谢谢, 编辑,来源: #!/usr/bin/php <?php $fd = fopen("php://stdin","r"); $email = ""; while (!feof($fd)) { $email .= fread($fd,1024); } fclose($fd); $dat = fopen(dirname(__FILE__).'/test.txt','w'); fwrite($dat,$email); fclose($dat);
看起来你正在运行php-cgi而你需要php-cli(只是“php”).运行php -v以确保.如果是这种情况,请尝试“-q”选项.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |