加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

cron php如何在追加文件时停止标题

发布时间:2020-12-13 17:16:22 所属栏目:PHP教程 来源:网络整理
导读:cron命令: /user/bin/php "/path/Script.php" /path/LogFile.html 当php输出到我的日志文件时,它总是先说出来 X-Powered-By: PHP/5.3.22 Content-type: text/html 所以使用我的输出文件,它看起来像: X-Powered-By: PHP/5.3.22 Content-type: text/html X-P
cron命令:

/user/bin/php "/path/Script.php" >> /path/LogFile.html

当php输出到我的日志文件时,它总是先说出来

X-Powered-By: PHP/5.3.22 Content-type: text/html

所以使用我的输出文件,它看起来像:

X-Powered-By: PHP/5.3.22 Content-type: text/html X-Powered-By: PHP/5.3.22 Content-type: text/html X-Powered-By: PHP/5.3.22 Content-type: text/html X-Powered-By: PHP/5.3.22 Content-type: text/html
 NEW DAY MARKER | 29/04/2013 00:00:07
 Total Exchanges: 73294
 Total GMT references: 7
 Exchanges pending approval: 4

输出是一种表格格式,导致重复的text / html标题溢出我的日志文件的前4或5页 – 因为它们介于两者之间

</tr> X-Powered-By: text/html <tr>

标签.

无论如何我可以告诉它在运行cron作业时不要输出那种头信息吗? (我不想将它全局禁用 – 需要Web界面才能与其他PHP脚本一起使用)

linux主机,cpanel,vps

解决方法

/user/bin/php -q "/path/Script.php" >> /path/LogFile.html

-q开关将以安静模式运行它,这将禁用标头输出

php command line help更多交换机

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读