我正在使用PHP 4.3.11,当我执行一个标题总是响应这样的错误
警告:无法修改标题信息 - 已在第2行的d:\ folder\file.php中发送的标题(输出从d:\ folder\file.php:1开始)
警告:无法修改标题信息 - 已在第3行的d:\ folder\file.php中发送的标题(输出从d:\ folder\file.php:1开始) 当前PHP版本:4.3.11
我用来生成此错误的代码是
<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
echo 'Current PHP version: ' . phpversion();
// prints e.g. '2.0' or nothing if the extension isn't enabled
echo phpversion('tidy');
?>
Run Code Online (Sandbox Code Playgroud)
它在php标签之前或之后没有空格或换行符,并且5.x版本中的相同代码只返回预期的php版本.
任何线索?
提前致谢
编辑: 解决了!:我用西欧编码打开了文件并删除了BOM并且工作正常.感谢你的帮助!