Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/272.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用unicode字符从mysql导出数据_Php_Export_Georgian - Fatal编程技术网

Php 使用unicode字符从mysql导出数据

Php 使用unicode字符从mysql导出数据,php,export,georgian,Php,Export,Georgian,将表排序规则更改为UTF8 在标题中添加以下内容: 标题(“内容传输编码:二进制”); 标题(“内容类型:文本/csv;字符集=utf-8”) 您也可以尝试mb_convert_encoding() 您也可以查看此链接 将表排序规则更改为UTF8 在标题中添加以下内容: 标题(“内容传输编码:二进制”); 标题(“内容类型:文本/csv;字符集=utf-8”) 您也可以尝试mb_convert_encoding() 您也可以查看此链接。executemysql\u查询(“SET NAMES'ut

将表排序规则更改为UTF8

  • 在标题中添加以下内容:

    标题(“内容传输编码:二进制”); 标题(“内容类型:文本/csv;字符集=utf-8”)

  • 您也可以尝试mb_convert_encoding()

  • 您也可以查看此链接

  • 将表排序规则更改为UTF8

  • 在标题中添加以下内容:

    标题(“内容传输编码:二进制”); 标题(“内容类型:文本/csv;字符集=utf-8”)

  • 您也可以尝试mb_convert_encoding()


  • 您也可以查看此链接。

    execute
    mysql\u查询(“SET NAMES'utf8';”连接后,结果以utf-8格式显示。数据库表的字符集是什么
    utf8
    在添加mysql_查询(“SET NAMES'utf8';”)后,mysql中支持有限数量的字符;结果:“??”改为:бѓбѓбѓбѓбѓ™бѓ“执行
    mysql_查询(“设置名称'utf8';”)连接后,结果以utf-8格式显示。数据库表的字符集是什么
    utf8
    在添加mysql_查询(“SET NAMES'utf8';”)后,mysql中支持有限数量的字符;结果:“??”改为:бѓбѓбѓбѓбѓ™бѓ“我添加了标题('Content-Transfer-Encoding:binary');但结果是一样的(表排序规则为utf8)您是否添加了“内容类型”?我在db.php中添加了“mysql_查询(“SET NAMES'utf8”);在export.phpHow中添加了标题(“content-Transfer-Encoding:binary”);在export.phpHow中添加了标题(“content-type:text/csv;charset=utf-8”);我可以在php中输出一个utf-8 csv,Excel可以正常读取吗?工作了!!!谢谢!我添加了标题('Content-Transfer-Encoding:binary');但结果相同。:(表排序规则为utf8您是否添加了'Content-type'?我在db.php和header('Content-Transfer-Encoding:binary');header(“Content-type:text/csv;charset=utf-8”)中添加了“mysql_查询”('SET NAMES'utf8'));在export.phpHow中,我可以在PHP中输出一个UTF-8 CSV,Excel可以正确读取吗?工作!!!谢谢!
    <?php
    include('db.php');
    
    //header to give the order to the browser
    header('Content-Type: text/csv');
    header('Content-Disposition: attachment;filename=exported-data.csv');
    
    //select table to export the data
    $select_table=mysql_query('select * from User');
    $rows = mysql_fetch_assoc($select_table);
    
    if ($rows)
    {
    getcsv(array_keys($rows));
    }
    while($rows)
    {
    getcsv($rows);
    $rows = mysql_fetch_assoc($select_table);
    }
    
    // get total number of fields present in the database
    function getcsv($no_of_field_names)
    {
    $separate = '';
    
    
    // do the action for all field names as field name
    foreach ($no_of_field_names as $field_name)
    {
    if (preg_match('/\\r|\\n|,|"/', $field_name))
    {
    $field_name = '' . str_replace('', $field_name) . '';
    }
    echo $separate . $field_name;
    
    //sepearte with the comma
    $separate = ',';
    }
    
    //make new row and line
    echo "\r\n";
    }
    ?>