Yii创建第一个测试页面


Yii create first test page

我是yii的新手,我已经安装了示例yii演示应用程序(默认(n现在我想创建新页面,但我收到了404错误。以下是我遵循的步骤。

1( 现场控制员创建新动作

public function actionTest()
{
  $this->render('test');
}

2( 在视图文件夹test.php中创建了新页面

echo "test";

3( 在main.php(配置文件(中添加了以下代码

'urlManager' => array(
      'urlFormat' => 'path', 
      'showScriptName' => false,
      'caseSensitive' => false,
      'rules' => array(
      'test' => 'site/test',
      ),  
),

4( 当我使用URL 运行应用程序时

http://localhost/YiiTest/test 

然后得到错误

The requested URL /YiiTest/test was not found on this server. 

确保您已经重写了.htaccess文件链接