我有我的應用程序中下面的代碼/開始/ global.php文件:無法在Laravel
App::missing(function($exception){
return Response::view('missing', array('url' => Request::url()), 404);
});
而且我有一個名爲missing.blade.php在app文件/視圖。然而,上面的代碼給了我一個FatalErrorException,告訴我「調用一個非對象的成員函數getPath()」。我得到上述信息的其他格式錯誤頁面的格式也是混亂的。
但是,當我在global.php更改我的代碼下面的一切工作正常:
App::missing(function($exception){
return Response::make("Page not found", 404);
});
我不明白這是怎麼回事。如何在未找到路線時顯示特定視圖?
編輯: 這裏是我的missing.blade.php文件:
@extends('master')
@section('header')
<h2>404 Error</h2>
@stop
@section('content')
<p>
Unable to locate page.
</p>
@stop
編輯2: 也在裏面我的應用程序/ views文件夾,我有一個master.blade.php文件以下結構:
...
@yield('header')
...
@yield('content')
...
我們可以看看你的missing.blade.php – Hailwood
我在上面的編輯中添加了missing.blade.php的內容。我在另一個文件中使用完全相同的佈局,沒有任何問題(即@extends和@部分)。 – chipit24
master.blade.php請 – Hailwood