[英]Yii2: Class 'Yii' not found
I was learning Yii framework a few days ago. 我几天前正在学习Yii框架。 I facing with the error below:
我面对以下错误:
Fatal error: Class 'Yii' not found in C:\\xampp\\htdocs\\LoginForm\\views\\user\\views\\default\\register.php on line 17
致命错误:在第17行的C:\\ xampp \\ htdocs \\ LoginForm \\ views \\ user \\ views \\ default \\ register.php中找不到类'Yii'
Try this first row: 试试第一行:
use Yii;
//other use statements
and then: 接着:
Yii::$app->...
OR you can make it work this way to: 或者,您可以通过以下方式使其起作用:
\Yii:$app->...
Yii is present in the root folder of the project. Yii位于项目的根文件夹中。 So you need to tell the program where to locate it.
因此,您需要告诉程序在哪里找到它。 Either write:
要么写:
use Yii 使用Yii
at the top along with the other use statements, or put a backslash before Yii like: \\Yii 与其他use语句一起放在顶部,或者在Yii之前加上反斜杠,例如:\\ Yii
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.