dev-master
9999999-deviterate rows from table
BSD-3-Clause
The Requires
by LinYanjun
yii2 table yii 2 iterate
1.0
1.0.0.0iterate rows from table
BSD-3-Clause
The Requires
by LinYanjun
yii2 table yii 2 iterate
iterate rows from table
iterate rows from table, specially for big tables that will cause php memory limit error., (*1)
遍历数据库表,尤其是会导致php内存错误的大表, (*2)
The preferred way to install this extension is through composer.推荐使用composer, (*3)
Either run命令行输入并运行, (*4)
php composer.phar require "postor/yii2-dbtable-iterate" "*"
or add或者在配置文件composer.json中添加, (*5)
"postor/yii2-dbtable-iterate": "*"
to the require section of your composer.json
file., (*6)
// commands/HelloController.php namespace app\commands; use app\models\Article; use postor\dbtableiterate\DbTableIterate; use yii\console\Controller; class HelloController extends Controller { public function actionIndex() { new DbTableIterate(Article::find()->offset(3)->limit(5),function($row){ echo $row->id.','; },3); } }
F:\xampp\htdocs\yii2postor\1>yii hello 1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19, F:\xampp\htdocs\yii2postor\1>yii hello 1,3,4,5,6, F:\xampp\htdocs\yii2postor\1>yii hello 5,6,7,8,9,
ActiveQuery $query: the query to get rows取数据的查询, (*7)
function $callback: each row will be pass into it查出来的每行都会传入这个回调, (*8)
int pageSize: get pageSize rows from db each time每次从数据库取出这么多, (*9)
iterate rows from table
BSD-3-Clause
yii2 table yii 2 iterate
iterate rows from table
BSD-3-Clause
yii2 table yii 2 iterate