index.php工作正常,但是http:// localhost / MySite /关于不工作

时间:2018-09-12 14:48:19

标签: php laravel

我在laravel中使用bigginer,我试图显示类似http://localhost/MySite/about的页面。我将server.php复制为index.php,但是当我在URL中输入http://localhost/MySite/abouthttp://localhost/MySite/可以工作,但是http://localhost/MySite/about不能工作。显示未找到对象的错误。请帮助

    <?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});
Route::get('/about', function () {
    return view('about');
});
Route::get('/contact', function () {
    return view('contact');
});
Route::get('/gallary', function () {
    return view('gallary');
});

2 个答案:

答案 0 :(得分:0)

我不是Laravel专家,但在我看来/ Mysite /在您的网址中引起了此问题。 您确定“ localhost / Mysite /”是webroot吗?

答案 1 :(得分:0)

如果您是从本地主机构建laravel应用的,则访问途径将永远是

http://localhost/NAMEOFTHEPROJECT/public/VIEW

如果您仍然遇到路线问题,请尝试执行以下操作

Route::get('/ROUTENAME', 'Controller@METHOD')->name('ROUTENAME');