欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

php 中输出 html 换行 使用 "\n" 如果使用 '\n' 就是直接输出了 有大用

$html = '';
if(!empty($categorys) && is_array($categorys)){
    $html .= '<ul class="list-group">'."\n";

    foreach($categorys as $key=>$category){
        $html .='<li class="list-group-item">'.$category['name'].'</li>'."\n";
        if(!empty($category['child']) && is_array($category['child'])){

            $html .= categorysul($category['child']);
        }
        $html .= '</li>'."\n";
    }
    $html .= '</ul>'."\n";
}
普通分类: