Home > Backend Development > PHP Tutorial > Examples of php exporting and importing csv files

Examples of php exporting and importing csv files

WBOY
Release: 2016-07-25 08:55:05
Original
1183 people have browsed it
  • < td>t10
    1. header("Content-type:application/vnd.ms-excel");

    2. header("content-Disposition:filename=downloaded.pdf ");< /p>
    3. echo "1t 2t 3n"; //where t is blank and n is carriage return (encoding specifications cannot be output directly)

    4. echo "1t 2t 3n";
    5. echo "1t 2t 3n";
    6. ?>
    Copy the code

    When you open this php file, you will be prompted to download it.

    It can also be output in the form of a table;

    1. header("Content-type:application/vnd.ms-excel ");
    2. header("content-Disposition:filename=downloaded.pdf");
    3. ?>
    4. < ;table>
    t00t01t02
    t11t12
    t20t22
    Copy code

    Second, use the fpubcsv() function to write the csv file. example:

    1. $fp = fopen('f:/file.csv', 'w');
    2. fputcsv($fp,array('aaa','bbb','cccc') ;
    source:php.cn
    Previous article:How to export CSV table file with PHP Next article:How to create images based on php gd library
    Statement of this Website
    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
    Latest Articles by Author
    Latest Issues
    Related Topics
    More>
    Popular Recommendations
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template