我是Laravel的初學者,我有一個具體的問題,我希望你可以發送正確的方向。 我已經閱讀並嘗試了很多在這個論壇上寫的解決方案,但沒有成功。Laravel 5.1中控制器到子文件夾的路由
Oke讓我們開始。
我想改變我的www.domain.com/support到子目錄www.domain.com/support/support
創建應用程序 - >的Http - >支持 - > SupportController.php並加入:
namespace app\Http\Controllers\Support; use app\Http\Controllers; /** * Display the Help Center. * * @return Response */ public function support() { return view('static.support'); }
添加在應用 - >的Http - > routes.php文件
Route::group(['domain' => env('APP_DOMAIN', 'domain.com'), ], function() { require 'Routes/general.php'; });
添加在應用 - >的Http - >路由 - > general.php
Route::get('/support', ['as' => 'static.support', 'uses' =>'Support\[email protected]']);
在以下文件夾中添加了support.blade.php資源 - >視圖 - >靜態 - >支持
謝謝
提供錯誤這是我tryed第一個選項,然後我收到錯誤500只是測試它again..not工作錯誤500.我還必須更改此值'=> 「static.support''? –
你應該看看你得到了什麼錯誤。你可以在'/ storage/logs/laravel.log'中找到錯誤信息。 –
我已經解決了這個問題。我添加了「支持/支持」,並且爲返回視圖添加了額外的支持。 '返回視圖('static.support.support');'像魅力一樣工作! 大家好,感謝您的幫助。 –