php limit usage: 1. Limit the number of results, the code is [$User = M('User');]; 2. Paging query, the code is [$Article = M('Article');$ Article->limit('10,25')->select();].
##php limit usage:
Usage 1. Limit the number of results
For example, to obtain 10 users who meet the requirements, call the following:$User = M('User'); $User->where('status=1')->field('id,name')->limit(10)->select();
$User = M('User'); $User->where('score=100')->limit(3)->save(array('level'=>'A'));
Usage 2. Paging query
is used for paging query of articles where the limit method is more commonly used, for example:$Article = M('Article'); $Article->limit('10,25')->select();
$Article = M('Article'); $Article->limit(10,25)->select();
Related free learning recommendations:php programming (video)
The above is the detailed content of What is the usage of php limit?. For more information, please follow other related articles on the PHP Chinese website!