[PHP错误]-Namespace declaration statement has to be the very first statement in the script

最近在PHP项目中改造类文件,重写命名空间,有时会出现如下异常:

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

原因如下:
1.命名空间声明语句必须在脚本的最前面;
2.<?php的声明必须在脚本的第一句,即使空格、空行也不行。