我有以下几行:
Route::get('/dashboard', function () {
return view('main.index');
});
但我的 View 位于 main/sub/index.blade.php
我试过了
Route::get('/dashboard', function () {
return view('main.sub.index');
});
还
Route::get('/dashboard', function () {
return view('main/sub.index');
});
没用。
最佳答案
将 View 移至:
resources/views/main/sub/index.blade.php
然后此代码将起作用:
Route::get('/dashboard', function () {
return view('main.sub.index');
});
来自 the docs :
Views are stored in the
resources/views
directory. Since this view is stored atresources/views/greeting.blade.php
, we may return it using the globalview
helper like so:
return view('greeting', ['name' => 'James']);
关于php - Laravel - 在子文件夹中返回 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48769328/