suchen

Heim  >  Fragen und Antworten  >  Hauptteil

namespaces - php namespace在linux提示错误

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

我在本地测试没问题了放上服务器就提示这个错误。

<?php
namespace common\modules\post\models;
use Yii;
use yii\db\ActiveRecord;
use yii\behaviors\TimestampBehavior;
use common\modules\user\models\User;

namespace得是第一个语句我也没错呀,到linux下怎么报错了

巴扎黑巴扎黑2906 Tage vor296

Antworte allen(3)Ich werde antworten

  • PHP中文网

    PHP中文网2017-04-10 16:56:06

    编码问题,编码造成了在namesapce之前还有不可见但可被php识别的字符。是UTF-8编码的吗?如果是,要使用无bomUTF-8文件编码。

    Antwort
    0
  • 高洛峰

    高洛峰2017-04-10 16:56:06

    如楼上所说,utf8-无DOM(BOM)
    windows下可以用notepad++方便查看编码.

    楼上勾引我犯错

    Antwort
    0
  • 大家讲道理

    大家讲道理2017-04-10 16:56:06

    应该叫BOM吧

    Antwort
    0
  • StornierenAntwort