欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php寫(xiě)入數(shù)據(jù)到CSV文件的方法

 更新時(shí)間:2015年03月14日 10:48:23   作者:work24  
這篇文章主要介紹了php寫(xiě)入數(shù)據(jù)到CSV文件的方法,涉及php操作csv文件的技巧,非常具有實(shí)用價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了php寫(xiě)入數(shù)據(jù)到CSV文件的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

<?php
$row = 0;
ini_set('max_execution_time', 300);
$cate;$item;$value;$us;
$fp = fopen("torah1.csv", "w");
if (($handle = fopen("t.csv", "r")) !== FALSE) {
  while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
    $num = count($data);
    $row++;
    for ($c=0; $c < $num; $c++) {
      if($c==0){   
      $us = $data[$c];
      }
      if($c==1){
      $item = explode(" ",$data[$c]);
      echo "<prE>";
      print_r($item);
      } elseif($c==2){
       $value=$data[$c];
      }
      elseif($c==3){
       $cate1 = $data[$c];
      }
      else{
      }
    } // end of for loop
    if($row > 1838)
    {
      exit;
    }
    fputcsv($fp, array($us,$item[0],$item[1],$item[2],$item[3]));
  }//End of While
 }// End of IF
  fclose($handle);
  fclose($fp);
?>

希望本文所述對(duì)大家的php程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論