我目前有这个代码随机排序列表项:
var $ul = $('#some-ul-id');
$('li', $ul).sort(function(){
return ( Math.round( Math.random() ) - 0.5 )
}).appendTo($ul);
Run Code Online (Sandbox Code Playgroud)
但是,有没有更好的解决方案呢?
如果我想从数据库添加路由规则,我该怎么办?我应该使用https://github.com/symfony-cmf/ChainRoutingBundle还是有另一个更简单的解决方案?