Home  >  Article  >  Backend Development  >  php读取csc文件并输出_PHP教程

php读取csc文件并输出_PHP教程

WBOY
WBOYOriginal
2016-07-13 09:53:12983browse

php读取csc文件并输出

   本文给大家分享的是php读取csc文件并输出的方法,方法一用到的是fgetcsv函数,方法二用到是fopen函数,有需要的小伙伴可以参考下。

  方法一:

  ?

1

2

3

4

5

6

7

8

9

10

11

12

$row = 0;

$j = 1; // Linea por la que quieres empezar

$file = "name.txt"; //Nombre del fichero

if (($handle = fopen($file, "r")) !== FALSE) {

while (($data = fgetcsv($handle, ",")) !== FALSE) {

print_r($data);

$j++;

$row++;

}

}

?>

  方法二:

  ?

1

2

3

4

$fh = fopen("contacts.csv", "r");

while($line = fgetcsv($fh, 1000, ",")) {

echo "Contact: {$line[1]}";

}

  以上所述就是本文的全部内容了,希望大家能够喜欢。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1003830.htmlTechArticlephp读取csc文件并输出 本文给大家分享的是php读取csc文件并输出的方法,方法一用到的是fgetcsv函数,方法二用到是fopen函数,有需要的小伙伴...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn