rka05
(Raghav Agarwal 05)
May 17, 2016, 5:48pm
1
Hi All,
I am new to Yii2.
I am having a might be very silly problem. I am just creating a controller and an action.
<?php
namespace app\controllers;
use Yii;
use yii\web\Controller;
class PostController extends Controller
{
public function actionIndex()
{
return $this->render('index');
}
}
?>
But after this when I hit request like
http://localhost/basicyii2/web/index.php?r=post/index
It says "Page Not Found".
But at the same time
http://localhost/basicyii2/web/index.php?r=site/index
is working.
Any help for this situation, will be highly appreciated.
Thanks
patrickm
(Yiiframework)
May 18, 2016, 3:44am
2
What is the name of the file that contains the Postcontroller class?
rka05
(Raghav Agarwal 05)
May 18, 2016, 4:01am
3
Thanks Patrick for your response.
There is a typo in the File name. Its PostContoller instead of PostController.
jelly
(Jellytran80)
July 12, 2016, 9:19am
4
Because you have not created folder post in folder views.
Check again folder structure:
basicyii2 > views > post > index.php
patrickm
(Yiiframework)
July 12, 2016, 10:05am
5
Jelly:
Because you have not created folder post in folder views.
Check again folder structure:
basicyii2 > views > post > index.php
That’s just plain wrong. What you describe would result in a 500 and not in the 404 op mentioned.
softark
(Softark)
July 31, 2016, 3:38am
6
[color="#006400 "]/* Moved from "Tips" to "General Discussions" */[/color]
lifuan
(Lifuan China)
July 31, 2016, 10:36am
7
the filename of Postcontroller must be PostController.php.