>我需要帮助,对此输出结果进行排序下面我的网站代码 :
<?php
foreach ($this->system->produk as $pr_key=>$pr_val):
if ($pr_val->status == 'on'):?>
<li>
<a href="<?php echo site_url(str_replace('_','-',$pr_key));?>"><?php echo $pr_val->nama;?></a>
</li>
<?php endif;?>
<?php endforeach;?>
知道如何对此输出进行排序吗?
你试过吗?
<?php
sort($this->system->produk);
foreach ($this->system->produk as $pr_key=>$pr_val):
if ($pr_val->status == 'on'):?>
<li>
<a href="<?php echo site_url(str_replace('_','-',$pr_key));?>"><?php echo $pr_val->nama;?></a>
</li>
<?php endif;?>
<?php endforeach;?>