当前位置:网站首页>PHP about problems such as memory overflow timeout caused by large amount of data exporting or traversing data
PHP about problems such as memory overflow timeout caused by large amount of data exporting or traversing data
2022-07-28 16:27:00 【Sun Fendou】
**
php With regard to the large amount of data, exporting data or traversing data leads to memory overflow timeout and other problems
**
Don't talk much, just go to the code
$p = 0;$pageSize=100; // Define the number of display bars per page
set_time_limit(0);// This is a fairy function. It's great , Its main function is to : Set the maximum execution time of the script , The unit is in seconds . If set to 0( zero ), There is no time limit .
while (
$list = db('user')->order('a.id desc')->limit($p*$pageSize, $pageSize)->select()// Get data per page , To separate
) {
foreach ($list as $k=>$v) {
// The following content is the exported list content copy can be omitted
$index = $k + $p * $pageSize + 3;
// switch ($v['type']) {
// case 1:
// $lx = ' Online order ';
// break;
// case 2:
// $lx = ' Offline order ';
// break;
// default:
// $lx = '';
// }
// $address = json_decode($v['address'], true);
$objPHPExcel->getActiveSheet()
->setCellValue('A'.$index, $v['uname'])
->setCellValue('B'.$index, $v['bid'].' ')
->setCellValue('C'.$index, $v['pid'].' ')
->setCellValue('D'.$index, $v['amount'].' ')
->setCellValue('E'.$index, $v['f_amount'].' ')
->setCellValue('F'.$index, $v['open_bank'])
->setCellValue('G'.$index, ' '.$v['card_number'].' ')
->setCellValue('H'.$index, $v['jg_name'].' ')
->setCellValue('I'.$index, ' '.$v['jg_number'].'')
->setCellValue('J'.$index, ' '.$v['id_card_code'].'');
$objPHPExcel->getActiveSheet()->getRowDimension($index)->setRowHeight(16);
}
$p++;// Page number increase
}
If you don't understand, you can change careers !
边栏推荐
- Basic structure and operation principle of solar street lamp
- Is MySQL query limit 1000,10 as fast as limit 10? If I want to page, what should I do?
- PHP计算坐标距离
- 李宏毅《机器学习》丨5. Tips for neural network design(神经网络设计技巧)
- Record doc
- NTC, PT100 thermal resistance to 4-20mA temperature signal converter
- JS queue
- Ask if you don't understand, and quickly become an advanced player of container service!
- Writing of factorial
- mysql查询 limit 1000,10 和limit 10 速度一样快吗?如果我要分页,我该怎么办?
猜你喜欢

The little red book of accelerating investment, "rush to medical treatment"?

LabVIEW Linx toolkit controls Arduino equipment (expansion-1)

Thoughts on solving the pop-up of malicious computer advertisements

Summary of for loop in JS

The deep displacement monitoring system wk813 is used to measure the deep displacement of slopes, dams, embankments, railways and building foundation pit excavation

解决电脑恶意广告弹窗的思路

5 亿用户,比微信还早四年……这个运营了 15 年的 APP 即将永久停服

关于标准IO缓冲区的问题

flashfxp 530 User cannot log in. ftp

Roson的Qt之旅#101 Qt Quick中的模型和视图
随机推荐
Implementation of skip table
c语言编程当中两个!!的作用
解决uniapp等富文本图片宽度溢出
Numpy ndarray learning < I > Foundation
Stm32f103c8t6 + 0.96 "I2C OLED display 3d_cube
HyperMesh自动保存(增强版)插件使用说明
Baidu editor ueeditor, when editing too much content, the toolbar is not visible, which is not convenient for editing or uploading problems
自动打包压缩备份下载及删除 bat脚本命令
Redis series 4: sentinel (sentinel mode) with high availability
Image semantic segmentation practice: tensorflow deeplobv3+ train your own dataset
解决电脑恶意广告弹窗的思路
Leetcode topic
Laser rangefinder non-contact surface crack monitor
Roson的Qt之旅#101 Qt Quick中的模型和视图
Brief tutorial for soft exam system architecture designer | software debugging
李宏毅《机器学习》丨4. Deep Learning(深度学习)
Temperature measurement and imaging accuracy of ifd-x micro infrared imager (module)
后台弹出layer提示
Common problems and precautions of remote serial port server (adapter) uart/i2c/1-wire/spi PS304
flashfxp 530 User cannot log in. ftp