我是新來laravel試圖學習布萊德,但有一個問題,這是令我震驚。 我有一個如何獲得laravel的@layout功能?
index.blade.php
@layout('master')
,我也有一個
master.blade.php
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Laravel: A Framework For Web Artisans</title>
<meta name="viewport" content="width=device-width">
</head>
<body>
hi from body
</body>
</html>
的問題是,當過我嘗試把它給了我一個 錯誤說
Unhandled Exception
Message:
View [master] doesn't exist.
Location:
C:\xampp\htdocs\laravel-laravel2\laravel\view.php on line 170
Stack Trace:
#0 C:\xampp\htdocs\laravel-laravel2\laravel\view.php(107): Laravel\View->path('master')
#1 C:\xampp\htdocs\laravel-laravel2\laravel\view.php(218): Laravel\View- >__construct('master', Array)
#2 C:\xampp\htdocs\laravel-laravel2\laravel\helpers.php(526): Laravel\View::make('master', Array)
#3 C:\xampp\htdocs\laravel-laravel2\laravel\view.php(386) : eval()'d code(2): view('master')
#4 C:\xampp\htdocs\laravel-laravel2\laravel\view.php(386): eval()
#5 C:\xampp\htdocs\laravel-laravel2\laravel\blade.php(71): Laravel\View->get()
#6 [internal function]: Laravel\Blade::Laravel\{closure}(Object(Laravel\View))
#7 C:\xampp\htdocs\laravel-laravel2\laravel\event.php(199): call_user_func_array(Object(Closure), Array)
#8 C:\xampp\htdocs\laravel-laravel2\laravel\event.php(138): Laravel\Event::fire('laravel.view.en...', Array, true)
#9 C:\xampp\htdocs\laravel-laravel2\laravel\view.php(348): Laravel\Event::until('laravel.view.en...', Array)
#10 C:\xampp\htdocs\laravel-laravel2\laravel\view.php(590): Laravel\View->render()
#11 C:\xampp\htdocs\laravel-laravel2\laravel\response.php(268): Laravel\View->__toString()
#12 C:\xampp\htdocs\laravel-laravel2\laravel\laravel.php(180): Laravel\Response->render()
#13 C:\xampp\htdocs\laravel-laravel2\public\index.php(34): require('C:\xampp\htdocs...')
#14 {main}
的index.blade.php
也請張貼的控制器代碼。 – dualed
@dhpratik,我有同樣的問題。你有沒有設法解決這個問題?你是怎麼做到的? --edit-- 我發現NetBeans沒有爲我創建的文件添加「.php」擴展名! –