user9433467
user9433467

Reputation:

Yii Controller Can't Find View

Hi guys i try to go to http://localhost:8080/index.php?r=post URL but i watch #404 Error. I use yii and I created a controller called

PostController.php

. You can watch my post controller codes here:

   <?php
       namespace backend\controllers;
       use yii\web\Controller;

       class PostController extends Controller{
       public function actionIndex()
       {
          return $this->render('index');
       }
    }

Also I created a index.php file inside

views/post

You can watch index.php codes under this text

<?php
echo 'This is a test';

Upvotes: 2

Views: 849

Answers (1)

did you try to modify your route with following? http://localhost:8080/post/index where post is your controller name and index action. Try to configure URL manager, adding some rules to handle route above. Yii 2.0 documentation is pretty extensive. Check This http://www.yiiframework.com/doc-2.0/guide-runtime-routing.html#url-formats

Upvotes: 0

Related Questions