1. 程式人生 > >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

ont 文件 space pac .net button php 解決 img

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