utf-8 bom头问题 thinkphp 报错 Namespace declaration statement has to be the very first statement in the script
<?php
namespace app\admin\controller;//命令空间
use think\controller;
class Entry extends Controller
{//首页
public function index()
{
echo 'Hello,ThinkPHP!';
}
}在访问上面的代码页面里,出现了
Namespace declaration statement has to be the very first statement in the script
这样的错误,我搜索了网上,很幸运的到了答案,原来是在保存文件的过程格式应该选择utf-8无BOM型。
本文介绍了一个关于ThinkPHP框架中出现的错误“Namespacedeclarationstatementhastobetheveryfirststatementinthescript”的解决方案。该问题源于文件保存时使用的UTF-8格式包含了BOM头,正确的做法是使用不带BOM头的UTF-8格式。
1348

被折叠的 条评论
为什么被折叠?



