The order method of the ThinkPHPCURD method is described in detail. The order method of the ThinkPHPCURD method is one of the coherent operation methods of the model. this method is used to sort the operation results. The specific usage is as follows: $ Model-where (status1)-order (iddes ThinkPHP CURD method's order method is one of the coherent operation methods of the Model. this method
Used to sort operation results.
The usage is as follows:
$Model->where('status=1')->order('id desc')->limit(5)->select();
Note:Coherent operation methods have no sequence. you can change the call sequence before the select method is called..
Supports sorting multiple fieldsFor example:
$Model->where('status=1')->order('id desc,status')->limit(5)->select();
If the desc or asc sorting rule is not specified, the default value is asc.
If your field conflicts with the mysql keyword, we recommend that you use the array method, for example:
$Model->where('status=1')->order(array('order','id'=>'desc'))->limit(5)->select();
The order method of the http://www.bkjia.com/PHPjc/825321.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/825321.htmlTechArticleThinkPHP CURD method is one of the model's coherent operation methods, which is used to sort the operation results. The usage is as follows: $ Model-where ('status = 1')-order ('Id des...