如在根目录下创建项目目录
/common/config/bootstrap.php
Yii::setAlias('@shop', dirname(dirname(__DIR__)) . '/shop');//前一个shop为别名,后一个shop为项目目录名
然后在项目目录下config.php
'controllerNamespace' => 'shop\controller',
再添加到新建的类顶部。
如在根目录下创建项目目录
/common/config/bootstrap.php
Yii::setAlias('@shop', dirname(dirname(__DIR__)) . '/shop');//前一个shop为别名,后一个shop为项目目录名
然后在项目目录下config.php
'controllerNamespace' => 'shop\controller',
再添加到新建的类顶部。