2017-05-24 156 views
0

我创建了一个laravel项目,我加入到资源/观点:2个叶片,Laravel视图路由

home.blade.php restaurants.blade.php

在laravel 5.4,我在web.php创建路由

Route::get('/', function() { 
    return view('home'); 
}); 
Route::get('restaurants', function() { 
    return view('restaurants'); 
}); 

当我打开我的项目localhost/food/public 家刀片正在打开。 当我点击的餐馆,将URL更改为:localhost/food/public/restaurants和给我:

Sorry, the page you are looking for could not be found. 

1/1 
NotFoundHttpException in RouteCollection.php line 179: 

截图路线清单:enter image description here

截图views文件夹: enter image description here

的htaccess:

<IfModule mod_rewrite.c> 
    <IfModule mod_negotiation.c> 
     Options -MultiViews 
    </IfModule> 

    RewriteEngine On 

    # Redirect Trailing Slashes If Not A Folder... 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)/$ /$1 [L,R=301] 

    # Handle Front Controller... 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule^index.php [L] 

    # Handle Authorization Header 
    RewriteCond %{HTTP:Authorization} . 
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
</IfModule> 
+0

查看路线列表'php artisan route:list'并检查您的网页是否存在。 – Webinion

+0

我检查了路由列表,页面出现,我查看了资源视图中的页面,它在那里 –

回答

0

您的图像显示您的项目处于htdocs/bitfood,而您假设代替htdocs/food

所以尽量开:

http://localhost/bitfood/public/restaurants

如果该页面没有加载正确,然后尝试打开:

http://localhost/bitfood/public/index.php/restaurants

..in为了检查概率lem可能会从.htaccess引发,因为它无法读取。

+0

http://localhost/bitfood/public/index.php/restaurants正在工作,但没有css,第一个链接给我错误,关于点心和食物,这是一个错误,我的项目是点点滴滴,一切都好。任何帮助? –

+0

任何帮助或解决方案? –

+0

将您的'.htaccess'附加到您的问题 – manix