PHP code example of pavle / yii-batch-result
1. Go to this page and download the library: Download pavle/yii-batch-result library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pavle / yii-batch-result example snippets
public function behaviors()
{
return array(
array(
'class' => '\pavle\batch\behaviors\BatchResultBehavior',
'batchSize' => 20
),
);
}
foreach(Product::model()->batch($condition, $params, $batchSize) as $products){
//products是一个batchSize数量的数据集
}
foreach(Product::model()->each($condition, $params, $batchSize) as $product){
//product是一个数据对象
}