2016-12-24 160 views
2

當我將.php文件更改爲.blade.php時出現錯誤。 在我改變它之前得到了這個錯誤。Laravel ::在此服務器上找不到請求的資源/ hello

Route::get('hello','[email protected]'); 

HelloController中

public function index() 
    { 
     $data = array(
    'name' => 'Rakesh', 
    'email' => '[email protected]'); 
     return View::make('hello.index')->with('data', $data); 
    } 

/public/hello/index.blade.php

<!DOCTYPE html> 
<html> 
    <head> 
    <meta charset="utf-8"> 
    <title>Laravel 5.3 - Home page</title> 
    </head> 
    <body> 
     <h1>Welcome Hello index </h1> 
     <h1>{!!$data!!}</h1> 
     <h1>{!!$data['email']!!}</h1> 
    </body> 
</html> 

錯誤

The requested resource /hello was not found on this server. 

回答

5

的觀點應該是resources/views文件夾,而不是當您創建具有相同的名稱作爲路線的公共文件夾中的文件夾,請改變你已經把在該文件夾的名稱,則會出現該錯誤public文件夾

+0

非常感謝,這是我的錯。我在YouTube上看到視頻,並跟着他。 –

+0

這是工作。謝謝 –

1

內公共文件夾,以便它有一個不同於你的路線名稱,這可能會解決你的錯誤

相關問題