时时商务社区

标题: 完美解决PHP中的Cannot modify header information 问题 [打印本页]

作者: 阿情    时间: 2018-2-14 08:12

            我就遇到这种问题,网上找到这个解决的方案,就收藏下
写PHP的朋友们肯定遇到过这样一个问题:通过header函数改变http协议头的时候,会出现一个类似下面格式的warning:
[U]复制代码[/U] 代码如下:
Warning: Cannot modify header information - headers already sent by
这是为什么呢?因为在使用header函数之前,您不能输出任何东西,包括用echo或var_dump等输出函数的输出,还有在
请看测试代码:
[U]复制代码[/U] 代码如下:
这段代码就是简单的header一下,在
我们用ultraEdit打开这个文件,切换到16进制,可以看到,在文本的开头,有EFBBBF,之后才是3C 3F 70 68 70 (
            
            
您可能感兴趣的文章:
  • php 模拟get_headers函数的代码示例
  • 使用php get_headers 判断URL是否有效的解决办法
  • php中get_headers函数的作用及用法的详细介绍
  • 探讨php中header的用法详解
  • PHP 使用header函数设置HTTP头的示例解析 表头
  • 浅析php header 跳转
  • 分享PHP header函数使用教程
  • php header功能的使用
            




    欢迎光临 时时商务社区 (http://bbs.4435.cn/) Powered by Discuz! X3.2