Home  >  Article  >  Backend Development  >  ThinkPHP double loop traversal output related content

ThinkPHP double loop traversal output related content

jacklove
jackloveOriginal
2018-06-15 10:32:092643browse

ThinkPHP double loop traversal output

Data table 1 Cat column

Data table 2 In article

$cat= D("Cat");
$in = D("In");$total = $cat -> select();foreach($total as $k => $v){   
     $total[$k]['new'] =$in -> where(array('cat_title' => $v['cat_title'])) -> limit(10) -> select();
      }$this -> assign('total',$total);

view page

<volist name="total" id="v">
                <dl class="noMr">
                    <dt class="comBg senseTle">
                    <a href="__APP__/part/{$v.cat_id}/" title="{$v.cat_title}" target="_blank">{$v.cat_title}</a>
                    </dt>
                    <volist name="v[&#39;new&#39;]" id="vo">
                        <dd>
                            <a class="txtellipsis" href="__APP__/spart/{$vo.in_id}.html" target="_blank" title="{$vo.in_title}">{$vo.in_title}</a>
                            <span>{$vo.in_tm}</span>
                        </dd>
                    </volist> 
                </dl>
            </volist>


This article explains the relevant content of ThinkPHP double loop traversal output. For more related content, please pay attention to the PHP Chinese website.

Related recommendations:

Introduction to the quick start method of ThinkPHP5

Introduction to the steps to use ThinkPHP

Unlockable query

The above is the detailed content of ThinkPHP double loop traversal output related content. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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