这是我的代码:
function export_csv()
{
$st = $this->input->get('st'); //Start Date
$en = $this->input->get('en'); //End Date
$sTable = 'TABLE_NAME';
$this->load->dbutil();
$aColumns = array('tempdisplayid AS ucid','uui','campaign_name','location','caller_id','skill','calltime','answertime','TIMEDIFF(answertime,calltime) as timetoanswer','endtime','talktime','duration','fallback_rule','dialed_number','type','agent','agent_did','disposition','status','hangup_by','transfer','transfer_to','comments','dial_status','customer_status','agent_status','audio','AgentStatus','CustomerStatus','user_response');
$this->db->select('SQL_CALC_FOUND_ROWS '.str_replace(' , ', ' ', implode(', ', $aColumns)), false);
$query = $this->db->get_where($sTable, array('date(calltime) >=' =>$st,'date(calltime) <=' =>$en));
$new_report = $this->dbutil->csv_from_result($query);
write_file('/csv/records-'.$st.'to'.$en.'.csv', $new_report);
$this->load->helper('download');
force_download('records-'.$st.'to'.$en.'.csv', $new_report);
}
过去30天内有64,145条记录。当我尝试下载时,链接变为dead.is有任何其他方法可以将无限制记录批量导出到csv
。
我在设置ini_set(&#39; max_execution_time&#39;,0)后测试了这个代码高达30000;它工作正常。
除了像xls这样可以显示批量记录的CSV以外的任何内容。
答案 0 :(得分:1)
while (!object1.hitTestObject(object2))
{
object1.x = Math.random() * stage.stageWidth;
object1.y = Math.random() * stage.stageHeight;
}
下载此helper并放入// top of your controller
ini_set('max_execution_time', 0);
// Also you can increase memory
ini_set('memory_limit','2048M');
最后像这样创建csv
system/helpers/
答案 1 :(得分:0)
我认为codeignator的max_execution_time
存在问题
您可以使用以下代码
来增加它转到文件
system/core/CodeIgniter.php
Ans搜索set_time_limit
您找到以下代码。在这里你可以增加你的时间
if (function_exists("set_time_limit") == TRUE AND @ini_get("safe_mode") == 0)
{
@set_time_limit(300);// increase according to your requirmrnt
}