Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/244.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel 4.2应用程序中的NotFoundHttpException_Php_Laravel 4 - Fatal编程技术网

Php Laravel 4.2应用程序中的NotFoundHttpException

Php Laravel 4.2应用程序中的NotFoundHttpException,php,laravel-4,Php,Laravel 4,我得到了一个laravel错误,我无法找出我的代码有什么问题会导致这个问题 问题是: Symfony\Component\HttpKernel\Exception\NotFoundHttpException …/­vendor/­laravel/­framework/­src/­Illuminate/­Routing/­RouteCollection.php148 如果有人需要更多的信息,请让我知道,我会提供 编辑:这是堆栈跟踪 #0 /home/action/workspace/ssbb/v

我得到了一个laravel错误,我无法找出我的代码有什么问题会导致这个问题

问题是:

Symfony\Component\HttpKernel\Exception\NotFoundHttpException
…/­vendor/­laravel/­framework/­src/­Illuminate/­Routing/­RouteCollection.php148
如果有人需要更多的信息,请让我知道,我会提供

编辑:这是堆栈跟踪

#0 /home/action/workspace/ssbb/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1049): Illuminate\Routing\RouteCollection->match(Object(Illuminate\Http\Request))
#1 /home/action/workspace/ssbb/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1017): Illuminate\Routing\Router->findRoute(Object(Illuminate\Http\Request))
#2 /home/action/workspace/ssbb/vendor/laravel/framework/src/Illuminate/Routing/Router.php(996): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#3 /home/action/workspace/ssbb/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(776): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#4 /home/action/workspace/ssbb/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(746): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#5 /home/action/workspace/ssbb/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#6 /home/action/workspace/ssbb/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#7 /home/action/workspace/ssbb/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#8 /home/action/workspace/ssbb/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#9 /home/action/workspace/ssbb/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(642): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#10 /home/action/workspace/ssbb/public/index.php(49): Illuminate\Foundation\Application->run()
#11 {main} [] []

由于我无法在评论部分发布,所以我将在这里发布

我的朋友,你需要告诉我们你要访问哪个url

根据您的路线建议,应该在浏览器localhost/laravel/-your project name-/public中使用此选项/

正如@jeemusu指出的,这部分代码是错误的

返回视图::生成'site::index',它应该是'site.index'

有一个接受三个参数的查询约束,这里只有两个参数

在这一行 使用“entry”,Page::where'slug',welcome'->first 请告诉我们你真正想做什么


这是因为找不到URL,所以我只是在我的/app/start/global.php中添加了以下代码,然后告诉我找不到的URL

App::missing(function($e) 
{ 
    $url = Request::fullUrl(); 
    Log::warning("404 for URL: $url"); 
    return Response::make('404 not found', 404); 
});

您可以使用以下代码检查所有内容。还要从日志文件中筛选404 NotFoundHttpException错误。 文件:app/start/global.php

 App::error(function(Exception $exception, $errorCode)
{
    $requestUrl = Request::fullUrl(); 
    $userAgent = Request::header('user-agent');

    if($errorCode != 404){
        Log::error('Exception', array(
            'errorCode' => $errorCode,
            'requestUrl' => $requestUrl,
            'userAgent' => $userAgent,
            'context' => $exception,
        ));     
    }

    return Response::view('error-page-path.error-404', array(), 404);
    // Here "error-404" is a blade view file in "error-page-path" directory
});

给我们看看代码。这是一个标准的404错误,如果看不到你到底做了什么,没有人能帮你看你想看的是哪一页?如果在routes.php文件中,该页面是如何定义的?以下是索引页面代码:@include'site::_partials/header'{{{$entry->title}}}{{$entry->body}}}@include'site::_partials/footer',这是该页面的路由代码:route::get'/',array'as'=>home',function{return View::make'site::index'->with'entry',Page::where'slug',welcome'->first;};将以上内容放在问题中而不是评论中,这样问题的可读性会更好。此外,还包括一些更多信息,如您试图访问的url,以及您试图调用的视图文件的位置。