Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Yii2中找不到手动添加的新页面(使用urlManager)?_Yii2_Yii2 Urlmanager - Fatal编程技术网

在Yii2中找不到手动添加的新页面(使用urlManager)?

在Yii2中找不到手动添加的新页面(使用urlManager)?,yii2,yii2-urlmanager,Yii2,Yii2 Urlmanager,在Yii2中,我手动添加了一个新页面backend/views/site/new.php 然后我在页面backend/views/site/index.php中给出了一个链接: <a href="<?= Yii::$app->urlManager->createUrl('site/new'); ?>"> New</a> 单击该链接时,会显示: 未找到(#404) 这里有什么问题?在SiteController.php中创建操作,如下所示 pu

在Yii2中,我手动添加了一个新页面
backend/views/site/new.php

然后我在页面
backend/views/site/index.php
中给出了一个链接:

<a href="<?= Yii::$app->urlManager->createUrl('site/new'); ?>"> New</a>

单击该链接时,会显示:

未找到(#404)


这里有什么问题?

SiteController.php中创建操作,如下所示

public function actionNew()
{
    return $this->render('new');
}
还可以在
views/site/new.php

在页面
backend/views/site/index.php中添加
New
page链接

<?= Html::a('New', ['new']) ?>