php – 文件格式UTF8与BOM导致“标头已发送” – 错误

参见英文答案 >
session_start() Error                                    3个

我有这个错误信息:

Warning: Cannot modify header information – headers already sent by (output started at /Applications/MAMP/htdocs/—/dbconnect.php:1) in /Applications/MAMP/htdocs/—/functions.php on line 84

这是dbconnect.php:

<?php if(!defined("INC")){
  define("INC", 1);
}
error_reporting(E_ALL);
require_once("config.mysqli.php");
@$mysqli = mysqli_connect($dbhost,$dbuser,$dbpass,$dbname) or die("No Db found");?>

还尝试过:

<?php ob_start(null);
if(!defined("INC")){
  define("INC", 1);
}
error_reporting(E_ALL);
require_once("config.mysqli.php");
@$mysqli = mysqli_connect($dbhost,$dbuser,$dbpass,$dbname) or die("No Db found");
ob_end_clean();?>

如果您需要更多信息,请与我们联系.谢谢!

最佳答案 看起来您可能有BOM错误.有关详细信息,请参阅此帖子:
session_start() Error

点赞