phpcms远程查询数据

<?php $type_array = ['1'=>'/套', '2'=>'/件', '3'=>'/片', '4'=>'/块', '5'=>'/沱', '6'=>'/颗', '7'=>'/盒', '8'=>'/提' ]; ?> 
    {pc:get sql="SELECT a.title, a.id, a.model_id,a.image, b.base_price, b.base_unit, b.update_time, b.rise_or_fall, b.udorder, b.update_numbers, b.thrid_url,b.udorder,b.priceud FROM 表一 as a left join 表二 as b on a.id = b.id where a.model_id=2 order by update_numbers desc" num="15" cache="3600" dbsource="hangqing" return="data" }
    <ul>
    {loop $data $key $val}
        <li>
            <a title="{$val['title']}" target="_blank" href="/a/{$val['id']}.html">
                <img src="{$val['image']}" />
                <?php
                    if($val['base_price'] >= 100000){
                        $val['base_price'] = $val['base_price']/10000 .'万';
                    }
                ?>
                <p >¥{$val['base_price']}{$type_array[$val['base_unit']]}</p>
                {if $val['rise_or_fall'] == 0}
                <span>升跌:<p >¥{$val['priceud']}@{$val['udorder']}%</p></span>
                {/if}
                {if $val['rise_or_fall'] == 1}
                <span>升跌:<p >升¥{$val['priceud']}↑{$val['udorder']}%</p></span>
                {/if}
                {if $val['rise_or_fall'] == 2}
                <span>升跌:<p >降¥{$val['priceud']}↓{$val['udorder']}%</p></span>
                {/if}
                <span>{$val['title']}</span>
            </a>
        </li>
    {/loop}
    </ul>
{/pc}

 

你可能感兴趣的