title: why can not my php script export complete csv file in my site?
body: <p>I export the csv file from my site using php , can only get about 8k codes.
  but when I using the same php script to export csv from my local test site , I can get completely codes ,about 500k. I am sure that the datebase in the site is the same with my local pc test datebase.</p>
  
  <p><img src="https://i.stack.imgur.com/RaJ9B.png" alt="enter image description here"></p>
  
  <pre><code>function export(){
          ini_set ('memory_limit', '32M');
          $this-&gt;db-&gt;execute('set names utf8');
          $result=$this-&gt;db-&gt;execute($this-&gt;query_sql);
          $csv_code='';
          $keys_line='';
          if($result-&gt;recordCount()&gt;0){
              while(!$result-&gt;EOF){
                  $v=$result-&gt;fields;
  
  
                  // 标题行
                  if($keys_line==''){
                      foreach($v as $k1=&gt;$v1){
                          $keys_arr[]=$k1;
                      }
                      $keys_line=implode(',',$keys_arr);
                      $csv_code.=$keys_line;
                  }
  
                  // 内容行
                  $values_arr=array();
                  foreach($v as $k1=&gt;$v1){
                      $str=preg_replace("@\s+@"," ",$v1); //替换换行
                      $str=preg_replace("@\"@","\"\"",$v1); //scv中需要将单个双引号转换成2个双引号
                      $str='"'.$str.'"';  // 用双引号括起来每个值
                      $values_arr[]=$str;
                  }
                  $values_line=implode(',',$values_arr);
                  $csv_code.="\n".$values_line;
                  $result-&gt;MoveNext();
              }
          }
  
          $filename = $this-&gt;csv_name.".csv";//文件名
          header("Content-type:text/csv");
          header("Content-Disposition:attachment;filename=".$filename);
          header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
          header('Expires:0');
          header('Pragma:public');
          $csv_code=iconv('UTF-8','GB2312//IGNORE',$csv_code);    //转码成gbk
          $csv_code=trim($csv_code);
          echo $csv_code;
          exit;
  
      }
  </code></pre>
  
  <p>if I remove these codes , I can get all data codes in page, why?</p>
  
  <pre><code>// $filename = $this-&gt;csv_name.".csv";//文件名
  // header("Content-type:text/csv");
  // header("Content-Disposition:attachment;filename=".$filename);
  // header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
  // header('Expires:0');
  // header('Pragma:public');
  // $csv_code=iconv('UTF-8','GB2312//IGNORE',$csv_code); //转码成gbk
  // $csv_code=trim($csv_code);
  </code></pre>