Yii2 重定向 404 找不到页面
Yii2 redirect 404 Page not found
我在 view/stock/three.php(我制作的)中有自定义页面,我在 StockController 中呈现它,然后尝试从 view/site/shop.[=25= 打开它] 与
<div class="pager "><a href="<?= Yii::$app->urlManager->createUrl(['/stock/three']) ?>">3</a></div>
但我得到 Not Found (#404) Page not found. 。 (我没有忘记设置 "use Url")
我也尝试使用以下命令从 SiteController 重定向它:
public function actionThree() {
return $this->redirect(['/stock/three']);
}
但也没有用,仍然得到 错误代码 404
也许您在 views/stock 文件夹中没有 'three.php' 文件或 'stock' 之前的正斜杠 ('/')。
试试这个
public function actionThree() {
return $this->redirect(['stock/three']);
}
我为我编写的页面创建了新模型和新控制器:
public function actionThree() {
return $this->render('three');
}
然后是
<div class="pager "><a href="<?php echo Url::to(['pages/three']) ?>">3</a></div>
工作
我在 view/stock/three.php(我制作的)中有自定义页面,我在 StockController 中呈现它,然后尝试从 view/site/shop.[=25= 打开它] 与
<div class="pager "><a href="<?= Yii::$app->urlManager->createUrl(['/stock/three']) ?>">3</a></div>
但我得到 Not Found (#404) Page not found. 。 (我没有忘记设置 "use Url") 我也尝试使用以下命令从 SiteController 重定向它:
public function actionThree() {
return $this->redirect(['/stock/three']);
}
但也没有用,仍然得到 错误代码 404
也许您在 views/stock 文件夹中没有 'three.php' 文件或 'stock' 之前的正斜杠 ('/')。
试试这个
public function actionThree() {
return $this->redirect(['stock/three']);
}
我为我编写的页面创建了新模型和新控制器:
public function actionThree() {
return $this->render('three');
}
然后是
<div class="pager "><a href="<?php echo Url::to(['pages/three']) ?>">3</a></div>
工作