Why does a Unicode PHP file generate a line break?

混江龙づ霸主 提交于 2019-12-11 05:13:49

问题


I have this code in my admin.php file:

 <?php include("include/php/auth.inc.php"); ?>
 <?php if (user_Type() != "admin") {header("location: index.php"); exit(0);} ?>
 <?php include("include/php/admin/admin.inc.php"); ?>
 <?php include("header.php"); ?>
 <?php include ("menu.php"); ?>
 <?php include ("admin_Panel.php"); ?>
 <?php include "footer.php" ?>

At line 3 I included a PHP file named admin.inc.php, this file contains only some functions and does not contain any HTML tag or any character outside <?php and ?>. When I change the file encoding to UTF-8 (with Notepad or other editors using save as) this file generates a line break in the output.


回答1:


Try to resave your file as UTF-8 without BOM

in Notepad++ in the main menu row there is Encoding -> Convert to UTF-8 without BOM




回答2:


Make sure there are no lines or even blank spaces before or after the php tags.



来源:https://stackoverflow.com/questions/13892722/why-does-a-unicode-php-file-generate-a-line-break

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!