类Blog \ Controllers \ Article不存在

时间:2013-11-24 21:58:17

标签: php laravel laravel-4

当我访问domain.com/article时,我收到错误:

Class Blog\Controllers\Article does not exist

造成这种情况或我做错了什么?

app/controllers/Article.php:

namespace Blog\Controllers;

use View;
use BaseController;

class Article extends \BaseController
{
    public function showIndex()
    {
        return 'index view';
    }

}

app/routes.php:

Route::controller('article', 'Blog\Controllers\Article');

1 个答案:

答案 0 :(得分:2)

您的namespacedirectory不匹配,请根据您的namespace psr-0

将此课程置于指定路径(已评论)内
// Class Path : "app/controllers/blog/controllers/Article.php"

namespace Blog\Controllers;

use View;
use BaseController;

class Article extends \BaseController
{
    public function getIndex()
    {
        return 'index view';
    }
}

另外,请注意getIndex()而不是showIndex()read more on documentation