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

php從csv文件讀取數(shù)據(jù)并輸出到網(wǎng)頁的方法

 更新時(shí)間:2015年03月14日 15:48:08   作者:work24  
這篇文章主要介紹了php從csv文件讀取數(shù)據(jù)并輸出到網(wǎng)頁的方法,涉及php中fgetcsv函數(shù)及數(shù)組遍歷的使用技巧,需要的朋友可以參考下

本文實(shí)例講述了php從csv文件讀取數(shù)據(jù)并輸出到網(wǎng)頁的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

<?php
$fp = fopen('sample.csv','r') or die("can't open file");
print "<table>\n";
while($csv_line = fgetcsv($fp)) {
  print '<tr>';
  for ($i = 0, $j = count($csv_line); $i < $j; $i++) {
    print '<td>'.htmlentities($csv_line[$i]).'</td>';
  }
  print "</tr>\n";
}
print '</table>\n';
fclose($fp) or die("can't close file");
?>

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

相關(guān)文章

最新評(píng)論