Laravel foreach渲染表中数据的格式有哪些

PHPz
Release: 2020-09-04 14:34:08
Original
2107 people have browsed it

Laravel foreach渲染表中数据的格式有哪些

Laravel foreach渲染表中数据的格式有:

列表显示时,运用foreach渲染表中对应的数据

渲染格式:

第一种方式:传输过来的对象形式

@foreach($data as $k => $v)
 
{{$v->name}}
 
@endforeach
Copy after login

第二种方式:传输过来的数组格式

@foreach($data as $v)
 
{{$v[‘name’]}}
 
@endforeach
Copy after login

第三种格式:

<?php foreach ($variable as $key => $value): ?>
 
 
<?php endforeach ?>
Copy after login

 

渲染结果:

Php传输数据:

企业微信截图_15920264173785.png

视图页面渲染:

 企业微信截图_15920264259835.png

浏览器渲染结果:

企业微信截图_15920264308086.png

推荐教程:《laravel开发

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template