PHP code example of haveyb / export-csv

1. Go to this page and download the library: Download haveyb/export-csv library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

haveyb / export-csv example snippets


$csv = new ExportCsv();

$sql = 'select admin_id,user_name,age from admin';

$head = ['用户ID', '用户名', '年龄'];

$csv->exportCsv($sql, $head, 'test_1', '后台用户表');