namespace

ReflectionException thrown with message "Class App\Controllers\Admin\AuthController does not exist"

Stacktrace:

18 ReflectionException in C:\wamp\www\laravel\bootstrap\compiled.php:235

17 ReflectionClass:__construct in C:\wamp\www\laravel\bootstrap\compiled.php:235

16 Illuminate\Container\Container:build in C:\wamp\www\laravel\bootstrap\compiled.php:205

15 Illuminate\Container\Container:make in C:\wamp\www\laravel\bootstrap\compiled.php:583

14 Illuminate\Foundation\Application:make in C:\wamp\www\laravel\bootstrap\compiled.php:5773

13 Illuminate\Routing\ControllerDispatcher:makeController in C:\wamp\www\laravel\bootstrap\compiled.php:5762

12 Illuminate\Routing\ControllerDispatcher:dispatch in C:\wamp\www\laravel\bootstrap\compiled.php:4973

11 Illuminate\Routing\Router:Illuminate\Routing{closure} in <#unknown>:0

10 call_user_func_array in C:\wamp\www\laravel\bootstrap\compiled.php:5331

9 Illuminate\Routing\Route:run in C:\wamp\www\laravel\bootstrap\compiled.php:4998

8 Illuminate\Routing\Router:dispatchToRoute in C:\wamp\www\laravel\bootstrap\compiled.php:4986

7 Illuminate\Routing\Router:dispatch in C:\wamp\www\laravel\bootstrap\compiled.php:715

6 Illuminate\Foundation\Application:dispatch in C:\wamp\www\laravel\bootstrap\compiled.php:696

5 Illuminate\Foundation\Application:handle in C:\wamp\www\laravel\bootstrap\compiled.php:7746

4 Illuminate\Session\Middleware:handle in C:\wamp\www\laravel\bootstrap\compiled.php:8353

3 Illuminate\Cookie\Queue:handle in C:\wamp\www\laravel\bootstrap\compiled.php:8300

2 Illuminate\Cookie\Guard:handle in C:\wamp\www\laravel\bootstrap\compiled.php:10962

1 Stack\StackedHttpKernel:handle in C:\wamp\www\laravel\bootstrap\compiled.php:657

0 Illuminate\Foundation\Application:run in C:\wamp\www\laravel\public\index.php:49

我是这样子写的:
Route::group(array('namespace' => 'App\Controllers\Admin'), function(){

Route::post('admin/login', array('as' => 'admin', 'uses' => 'AuthController@postLogin'));
});
提示上面的结果。

当我这样子写通过:
Route::group(array('namespace' => 'App\Controllers\Admin'), function(){

Route::post('admin/login', function(){
return 'asdasdasd';
});
});
这是为什么,求大神们教教我这个初学者。谢谢!

4 个评论

kelson

kelson

请看这里:
http://v4.golaravel.com/docs/4.2/routing#named-routes
2014-11-27 14:50
奋灬斗

奋灬斗 回复 kelson

我在我的控制器文件中加了这些:
<?php namespace App\Controllers\Admin;

use BaseController;
use Redirect;
use Sentry;
use View;
use Input;
use Mail;
use Validator;
use Cache;
use Event;
use Sefa\Services\Mailer;

class AuthController extends BaseController {
public function postLogin() {
return 'hello world';
}
}

就是出现上面的错误,不晓得怎么搞,我也看了手册文档,跟上面写的没有错啊,不清楚还要修改哪里?
2014-11-27 16:38
奋灬斗

奋灬斗

找到答案了,谢谢这么仁兄了,太感谢他了,这是网址:http://my.oschina.net/lewisliang/blog/195194
2014-11-27 17:01
FiveSay

FiveSay 回复 奋灬斗

结贴很好,但不要把问题发成文章。
2014-11-27 18:08

要回复文章请先登录注册