在yii中的模块文件夹中创建和访问新文件夹

在yii中的模块文件夹中创建和访问新文件夹,yii,yii2,yii2-advanced-app,yii2-basic-app,yii-components,Yii,Yii2,Yii2 Advanced App,Yii2 Basic App,Yii Components,Yii非常新,需要帮助在模块下的Yii中创建一个新文件夹,并像控制器一样访问它。我需要创建一个脚本文件夹,将所有脚本保存在一个文件夹中。我在模块级别创建了一个文件夹,其中有一个controller文件夹,其中包含test.php文件,当我尝试访问URL时,我得到一个404(即SITE_URL/script/test/here)。尝试在此处使用index.php?r=script/test/但它仅显示索引页面 root/modules/script/controller/TestControlle

Yii非常新,需要帮助在模块下的Yii中创建一个新文件夹,并像控制器一样访问它。我需要创建一个脚本文件夹,将所有脚本保存在一个文件夹中。我在模块级别创建了一个文件夹,其中有一个controller文件夹,其中包含test.php文件,当我尝试访问URL时,我得到一个404(即SITE_URL/script/test/here)。尝试在此处使用index.php?r=script/test/但它仅显示索引页面

root/modules/script/controller/TestController.php

namespace app\modules\script\controllers;
class TestController extends \yii\web\Controller
{
   public function actionHere()
   {
     echo "here";
   }
}
根/模块/脚本

namespace app\modules\script;

class ScriptModule extends \yii\base\Module
{
    public $controllerNamespace = 'app\modules\script\controllers';
    public function init()
    {
        parent::init();
    }
}
config/web.php

'modules' => [
'script' => [
  'class' => ScriptModule::class,
 ],
]
任何帮助都将不胜感激。谢谢

参考: