RouteCollection中的NotFoundHttpException

时间:2016-11-16 00:42:12

标签: php laravel laravel-5.2 laravel-routing

我尝试将我的laravel应用程序放到在线主机上,对于前端,它的工作在ajibb.com上尝试,但是当我尝试登录到admin不工作时,对于localhost工作很好。当我尝试打开管理员我得到错误:

Sorry, the page you are looking for could not be found.
NotFoundHttpException in RouteCollection.php line 161:
in RouteCollection.php line 161
at RouteCollection->match(object(Request)) in Router.php line 755
at Router->findRoute(object(Request)) in Router.php line 610
at Router->dispatchToRoute(object(Request)) in Router.php line 596
at Router->dispatch(object(Request)) in Kernel.php line 267
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
at Pipeline->then(object(Closure)) in Kernel.php line 149
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
at Kernel->handle(object(Request)) in index.php line 57

错误可以指出我应该设置哪个部分,网址为www.ajibb.com/admin。感谢

3 个答案:

答案 0 :(得分:2)

你的路线文件中应该有这样的东西:

Route::get( 'admin', [
    'uses' => 'AdminController@getIndex', // point to your admin controller
    'as'  => 'admin.index' // give your route an optional name
]);

或者只是用

进行测试
Route::get( 'admin', function() { return 'works!' });

答案 1 :(得分:0)

route.php文件中的引用链接不可用时,抛出RouteCollection中的NotFoundHttpException

确保您的链接在route.php

中可用
Route::get( 'admin', function() {
return 'your admin view';
 });

如果您使用控制器,

Route::get( 'admin','your admin controller@index'); //assuming you used default

答案 2 :(得分:0)

如果它在localhost上工作正常,我很确定你的服务器上缺少一些东西。在我经验丰富的php-xml插件之前,如果是这样你就必须安装它。我假设你正在运行ubuntu服务器和php 7然后:

sudo apt-get update
sudo apt-get install php7.0-xml

或者如果已安装,请确保在php.ini配置中启用它。