{"id":1163,"date":"2015-03-31T09:20:36","date_gmt":"2015-03-31T01:20:36","guid":{"rendered":"http:\/\/www.awaysoft.com\/taor\/?p=1163"},"modified":"2015-03-31T09:28:17","modified_gmt":"2015-03-31T01:28:17","slug":"%e5%b8%a6%e5%91%bd%e5%90%8d%e7%a9%ba%e9%97%b4%e7%9a%84%e7%b1%bb%e6%96%b9%e6%b3%95%e4%b8%ad%e4%bd%bf%e7%94%a8usort","status":"publish","type":"post","link":"https:\/\/actom.me\/blog\/%e5%b8%a6%e5%91%bd%e5%90%8d%e7%a9%ba%e9%97%b4%e7%9a%84%e7%b1%bb%e6%96%b9%e6%b3%95%e4%b8%ad%e4%bd%bf%e7%94%a8usort.html","title":{"rendered":"\u5e26\u547d\u540d\u7a7a\u95f4\u7684\u7c7b\u65b9\u6cd5\u4e2d\u4f7f\u7528usort"},"content":{"rendered":"<p>usort\u5728\u8c03\u7528\u7c7b\u65b9\u6cd5\u65f6\uff0c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u9700\u8981\u4f7f\u7528array\uff0carray\u7b2c\u4e00\u9879\u4e3a\u7c7b\u540d\uff0c\u7b2c\u4e8c\u9879\u4e3a\u65b9\u6cd5\u540d\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u8be5\u65b9\u6cd5\u5fc5\u987b\u4e3a\u9759\u6001\u65b9\u6cd5\uff0c\u5982\u679c\u7c7b\u662f\u5e26\u547d\u540d\u7a7a\u95f4\u7684\uff0c\u9700\u8981\u5199\u5305\u542b\u547d\u540d\u7a7a\u95f4\u7684\u7c7b\u540d\u79f0\uff0c\u8282\u9009\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:php decode:true \">namespace Home\\Controller;\r\n\r\nclass TreeListController{\r\n\r\n    static function sortFun($a, $b) {\r\n        if ($a['index'] == $b['index']) {\r\n            return 0;\r\n        }\r\n        return ($a['index'] &gt; $b['index']?1:-1);\r\n    }\r\n\r\n    private function getList($type, $list = array()) {\r\n        $navigations = C('NAVIGATION_LIST');\r\n        $configs = $navigations[$type];\r\n        usort($configs, array('Home\\Controller\\TreeListController', 'sortFun'));\r\n        return $configs;\r\n    }<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>usort\u5728\u8c03\u7528\u7c7b\u65b9\u6cd5\u65f6\uff0c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u9700\u8981\u4f7f\u7528array\uff0carray\u7b2c\u4e00\u9879\u4e3a\u7c7b\u540d\uff0c &#8230; <a class=\"more-link\" href=\"https:\/\/actom.me\/blog\/%e5%b8%a6%e5%91%bd%e5%90%8d%e7%a9%ba%e9%97%b4%e7%9a%84%e7%b1%bb%e6%96%b9%e6%b3%95%e4%b8%ad%e4%bd%bf%e7%94%a8usort.html\">Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/posts\/1163"}],"collection":[{"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/comments?post=1163"}],"version-history":[{"count":1,"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/posts\/1163\/revisions"}],"predecessor-version":[{"id":1164,"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/posts\/1163\/revisions\/1164"}],"wp:attachment":[{"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/media?parent=1163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/categories?post=1163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actom.me\/blog\/wp-json\/wp\/v2\/tags?post=1163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}