Home  >  Article  >  Backend Development  >  Smarty 数组排序

Smarty 数组排序

WBOY
WBOYOriginal
2016-06-20 12:26:371150browse

如何用smarty按时间从小到大排序?

<{$time}>array(    "11:45" => array("title1"=>"1", "title2"=>"2"),    "13:00" => array("title1"=>"7", "title2"=>"22"),    "09:45" => array("title1"=>"2", "title2"=>"32"),    "10:30" => array("title1"=>"6", "title2"=>"52"))



回复讨论(解决方案)

排好序再发送给smarty  或者在smarty里面加载php标签进行排序

为何不用php排序好了再传给smarty??
一句代码的事
ksort($arr);

排好序再发送给smarty  或者在smarty里面加载php标签进行排序



为何不用php排序好了再传给smarty??
一句代码的事
ksort($arr);



我在smarty那修改的话,就不用看之前同事在php写的代码
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