【发布时间】:2017-06-10 04:04:39
【问题描述】:
我想在请求 url 时显示一个页面,但我得到的是一个空白页面,尽管页面中有内容。我一直试图弄清楚我的代码可能有什么问题,但到目前为止还没有提出任何问题。这是我的代码中的内容
在我的 web.php 文件中,我有这条路线
Route::get('/home', 'HomeController@index')->name('home');
// Student
Route::get('/students', 'StudController@index');
Route::get('/student/create', 'StudController@create');
Route::post('/students', 'StudController@store');
// Employee
Route::get('/employees', 'EmpController@index');
Route::get('/employee/create', 'EmpController@create');
Route::post('/employees', 'EmpController@store' );
Route::get('/employee/{id}', 'EmpController@show');
// Faculty
Route::get('/faculty', 'FacultyController@index');
在 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>
这是resources/views/emp/文件夹中我的employee.blade.php
@extends('layouts.master')
@section('content')
<h3>Why is this page blank?</h3>
@endsection
错误报告设置为 true。我错过了什么?这应该很简单
【问题讨论】:
-
你不想在 show 函数中捕获 Id 吗?
-
检查你的错误日志,如果它显示一个白页,肯定有一些致命错误。并确保您已将环境设置为 .env 文件中的应用程序
-
@ParthVora 这是来自日志文件的错误 异常 'Symfony\Component\Debug\Exception\FatalErrorException' 并在 E:\ wamp64\www\schoolAdmin\routes\web.php:39 和这些是第 36 到 39 行 Route::get('/employee/{id}', 'EmpController@show'); // 教师路线::get('/faculty', 'FacultyController@index');
-
@Jagrati 我当然会这样做,此时只测试路线。
-
你能用完整的 routes/web.php 文件更新问题吗?
标签: laravel-5