php - Yii Controller Can't Find View

351

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';
343

Answer

Solution:

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

People are also looking for solutions to the problem: php - MySql - three sucessfully joined tables, but failing to get one column result?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.