Blogger Information
Blog 12
fans 0
comment 0
visits 27688
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
TP5.1的view助手函数的使用!
小生我怕怕啊的博客
Original
1639 people have browsed it

php5.1或者TP6版本的view助手方法的使案例,带给新手!

public function Cate_list()
{
    //查询数据
    $list = Db::name('cate')->select();
    
    //使用view助手方法,选择显示的模板,并把数据$list投递数到模板,模板中数据名为$data
    return view('article/cate', ['data' => $list]);
}

在模板中使用,(记住是data不是list)

{foreach $data as $key=>$vo } 
    {$vo.id}:{$vo.name}
{/foreach}


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post