雨燕 - CnSwift

敏捷开发- agile development

Laravel视图

Laravel视图

控制器

with

compact

1
2
3
4
5
6
7
8
9
10
11
12
13
public function index(){
// 定义变量
// $name = '张三';
// $age = 26;

$data = array(
'name' => 'frank',
'age' => 26,
);
$title = 'This is my first laravel view';
// return view('mylaravel')->with('name', $name)->with('age', $age);
return view('mylaravel', compact('data', 'title'));
}

视图文件

1
2
<div class="title"><?php echo $data['name'] ?>--<?php echo $data['age'] ?></div>
<p><?php echo $title ?></p>
感谢赞赏.

Welcome to my other publishing channels