
Warning: Cannot modify header information - headers already sent by (output started at
出这个错误是因为 header('Content-Type:text/html;charset= UTF-8'); 代码之前有输出或者header();函数前面有输出内容就会提示这个错误。
可以直接把这段代码放在页面文件的最前面,即可。
如果有要设置字符集可以用 echo '<meta charset="UTF-8">'; 代替,
如果要header("location:index.php"); 跳转 ,直接用echo '<script>window.location.href='index.php'</script>'; 一样的效果。