Yii 控制器找不到视图
Yii Controller Can't Find View
大家好,我想去 http://localhost:8080/index.php?r=post URL,但我看到 #404 错误 。
我使用 yii 并创建了一个名为
的控制器
PostController.php
。
你可以在这里观看我的 post 控制器代码:
<?php
namespace backend\controllers;
use yii\web\Controller;
class PostController extends Controller{
public function actionIndex()
{
return $this->render('index');
}
}
我还在
中创建了一个 index.php 文件
views/post
您可以观看index.php本文下方的代码
<?php
echo 'This is a test';
您是否尝试通过以下方式修改您的路线?
http://localhost:8080/post/index
其中 post 是您的控制器名称和索引操作。
尝试配置 URL 管理器,添加一些规则来处理上面的路由。 Yii 2.0 文档非常丰富。
检查这个 http://www.yiiframework.com/doc-2.0/guide-runtime-routing.html#url-formats
大家好,我想去 http://localhost:8080/index.php?r=post URL,但我看到 #404 错误 。 我使用 yii 并创建了一个名为
的控制器PostController.php
。 你可以在这里观看我的 post 控制器代码:
<?php
namespace backend\controllers;
use yii\web\Controller;
class PostController extends Controller{
public function actionIndex()
{
return $this->render('index');
}
}
我还在
中创建了一个 index.php 文件views/post
您可以观看index.php本文下方的代码
<?php
echo 'This is a test';
您是否尝试通过以下方式修改您的路线? http://localhost:8080/post/index 其中 post 是您的控制器名称和索引操作。 尝试配置 URL 管理器,添加一些规则来处理上面的路由。 Yii 2.0 文档非常丰富。 检查这个 http://www.yiiframework.com/doc-2.0/guide-runtime-routing.html#url-formats