执行20000+条数据后会停止运行,是超时的原因么?
set_time_limit(0) 无效
// 请把代码文本粘贴到下方(请勿用图片代替代码)
public function doMerchantInfo() {
$merchantId = $input->get('merchantId');
$where = " grade_id <> 0 ";
$merchantNumber = Libs_Merchant_Merchant::getMerchantNumber($where);
if ($merchantNumber) {
for ($i = 0; $i < $merchantNumber; $i += 5000) {
$merchantInfo = Libs_Merchant_Merchant::getMerchantInfo(array("id"), $where, array('id' => 'asc'), $i, 5000);
if (is_array($merchantInfo) && !empty($merchantInfo)) {
foreach ($merchantInfo as $val) {
echo "\n";
echo $val['id'];
echo "\n";
self::setCache('Merchant_MerchantInfo', array('merchantId' => $val['id']));
// 记录日志
Db_ShopLog::replaceData('zs_merchant_cache_log', array(
'mer_id' => $val['id'],
'add_time' => date("Y-m-d H:i:s"),
));
}
}
unset($merchantInfo);
}
}
exit;
}
慕的地8271018