在 yii 的 modules 文件夹中创建和访问一个新文件夹

问题描述

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

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,],]

任何帮助将不胜感激。谢谢!

参考:Creating Views

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)