我們在Routes.php中新建一個路由
在瀏覽器中瀏覽會獲得一個錯誤,錯誤信息僅僅是一個提示信息,缺少細節,在生產環境 It' ok,但是開發階段我們希望獲得詳細信息。
在項目的根目錄找到 .env 文件,修改
這將顯示詳細的錯誤信息,PagesController 不存在。但在生產環境一定要設置為 false
我們可以手工新建控制器,但更快的方式是利用 laravel 提供的生成器。在命令行當前項目目錄中運行:
可以看到laravel提供的功能。
- <?php namespace App/Http/Controllers;
- use App/Http/Requests;
- use App/Http/Controllers/Controller;
- use Illuminate/Http/Request;
- class PagesController extends Controller {
- /**
- * Display a listing of the resource.
- *
- * @return Response
- */
- public function index()
- {
- //
- }
- /**
- * Show the form for creating a new resource.
- *
- * @return Response
- */
- public function create()
- {
- //
- }
- /**
- * Store a newly created resource in storage.
- *
- * @return Response
- */
- public function store()
- {
- //
- }
- /**
- * Display the specified resource.
- *
- * @param int $id
- * @return Response
- */
- public function show($id)
- {
- //
- }
- /**
- * Show the form for editing the specified resource.
- *
- * @param int $id
- * @return Response
- */
- public function edit($id)
- {
- //
- }
- /**
- * Update the specified resource in storage.
- *
- * @param int $id
- * @return Response
- */
- public function update($id)
- {
- //
- }
- /**
- * Remove the specified resource from storage.
- *
- * @param int $id
- * @return Response
- */
- public function destroy($id)
- {
- //
- }
- }
ok,在 app->http->controller 下面生成了 PagesController.php
新聞熱點
疑難解答