首页 > 代码库 > Namespace declaration statement has to be the very first statement in the script

Namespace declaration statement has to be the very first statement in the script

php 中 

 Namespace declaration statement has to be the very first statement in the script 错误解决方法:

 

在PHP文件中编写有namespace 时候提示此错误,应该将  <?php  开始前面不能有语句,空行也不行。

如果是在含有<html>语言的混合php 文件里面,且文件里面至少有一个<?php   ?>代码段时候,只要用到namespace,该文件的首行必须以<?php开头.

 

技术分享

 

Namespace declaration statement has to be the very first statement in the script