开发者

how to take a report in CSV format in php codeigniter

开发者 https://www.devze.com 2022-12-13 03:16 出处:网络
how to take a repo开发者_如何学JAVArt in CSV format in php codeigniternevermind codeigniter. fgetcsv is your friend.

how to take a repo开发者_如何学JAVArt in CSV format in php codeigniter


nevermind codeigniter.

fgetcsv is your friend.

from the php manual:

<?php
$row = 1;
if (($handle = fopen("test.csv", "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        $num = count($data);
        echo "<p> $num fields in line $row: <br /></p>\n";
        $row++;
        for ($c=0; $c < $num; $c++) {
            echo $data[$c] . "<br />\n";
        }
    }
    fclose($handle);
}
?>
0

精彩评论

暂无评论...
验证码 换一张
取 消