使用 View
1.建立 blade 檔
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Home</title>
</head>
<body>
Hello Laravel ~~
</body>
</html>2.在 route 中傳回這個 view
傳遞資料
Last updated
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Home</title>
</head>
<body>
Hello Laravel ~~
</body>
</html>Last updated
Route::get('/', function()
{
return View::make('home');
});return View::make('home')
->with('title', '首頁')
->with('hello', '大家好~~');<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{ $title }}</title>
</head>
<body>
{{ $hello }}
</body>
</html>{{ $title }}<?php echo $title; ?>{{ isset($name) ? $name : 'Default' }}{{ $name or 'Default' }} {{ xxx }}
及
{{{ xxx }}}->with('hello', '<h1>大家好~~</h1>');
在 {{ $hello }} 中會以 h1 的格式表現。而在 {{{ $hello }}} 中,會顯示為
<h1>大家好~~</h1>