2017-06-07 57 views
0

我想显示一个页面,当一个url被请求,但我得到的是一个空白页面,尽管页面中有内容的事实。我一直在试图弄清楚我的代码有什么问题,但到目前为止还没有提出任何问题。下面是我在我的代码Laravel 5请求的网址显示空白页面没有错误

在我web.php文件,我有这个路线

Route::get('/home', '[email protected]')->name('home'); 

// Student 
Route::get('/students', '[email protected]'); 

Route::get('/student/create', '[email protected]'); 

Route::post('/students', '[email protected]'); 

// Employee 
Route::get('/employees', '[email protected]'); 

Route::get('/employee/create', '[email protected]'); 

Route::post('/employees', '[email protected]'); 

Route::get('/employee/{id}', '[email protected]'); 

// Faculty 
Route::get('/faculty', '[email protected]'); 

在EmpController文件,这是显示id为员工(注意缺少的方法查询我只是想试探看看,当请求此URI将显示一个页面)

public function show() 
{ 
    return view('emp.employee'); 
} 

这是链接

<a href="/employee/{{ $employee->id }}" data-toggle="tooltip" title="View"><i class="fa fa-file-text-o" aria-hidden="true"></i></a> 

这是我的资源/视图/ EMP /文件夹

@extends('layouts.master') 

@section('content') 
    <h3>Why is this page blank?</h3> 
@endsection 

错误报告设置为true里面employee.blade.php。我错过了什么?这应该很简单

+0

你不想在show功能中捕捉Id吗? – Jagrati

+0

检查您的错误日志,如果它显示白页,则必须有一些致命错误。并确保您已将环境设置为.env文件中的应用程序 –

+0

@ParthVora此错误来自日志文件异常'Symfony \ Component \ Debug \ Exception \ FatalErrorException',并带有消息'syntax error,unexpected'Route'(T_STRING )'在E:\ wamp64 \ www \ schoolAdmin \ routes \ web.php:39 **中,这些行是36到39行Route :: get('/ employee/{id}','EmpController @ show'); //师资 路线:: get('/ faculty','FacultyController @ index'); – Mena

回答

0

重新启动我的系统后,我仍然无法正确访问链接。检查laravel.log文件并没有指出它的问题。但是我能够通过创建另一个控制器来解决这个问题,并且一切都很完美。仍然不知道为什么我有问题。