php - yii2.0 language pack problem
淡淡烟草味
淡淡烟草味 2017-06-06 09:53:46
0
1
676

I built a Chinese language package in frontend>messages, why can’t it be used in the form model in frontend>model? 'id'=> Yii::t('common','ID'), says Yii is an undefined class? Please God, what is going on?

This is the code for the language pack:

return [
    'Blog'=>'博客',
    'Article'=>'文章',
    'Signup'=>'注册',
    'Login'=>'登录',
    'Email' => '邮箱',
    'artTitle'=> '文章标题',
];

This is the calling code:

public function attributeLabels()
    {
        return [
            //'id'=> Yii::t('common','ID'),
            //'id' => '编码',
            //'title' => '标题',
            'title' => yii::t('common','artTitle'),
            'content' => '内容',
            'label_img' =>'标签图',
            'tags' => '标签',
            'cat_id'=>'分类'
        ];
    }

yii said it is an undefined class~
Please give me some guidance on how to modify it

淡淡烟草味
淡淡烟草味

reply all(1)
滿天的星座

If you do not use Yii, you need Yii:t() to indicate that you are searching in the root namespace.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template