This article mainly introduces the PHP operation with the Chinese content of Excel file and file export, interested in the reference of friends, I hope to be helpful to everyone.
This example describes the PHP export Chinese content Excel file class, as follows:
<?php class toexcel{public $link = null; function __construct () {}/*************************************************************************** * $ Mapping: Array header information $map=array (' No ', ' Name ', ' Email ', ' age '); * $datalist: Result set found in database * $fileName: Excel file name * return:excel format file **************************************************** /Public Function Toexcel ($mapping, $datalist, $fileName) {header ("content-type:application/ Vnd.ms-excel "); Header ("Content-disposition:filename=". Iconv (' Utf-8 ', ' gb2312 ', $fileName). " XLS "); Echo '
Method Two
<?php header ("content-type:application/vnd.ms-execl"); Header ("content-disposition:attachment; Filename=myexcel.xls "); Header ("Pragma:no-cache"); Header ("expires:0"); /*first line*/$data 1 = "Chinese test"; $data 1=mb_convert_encoding ($data 1, "GB2312", "UTF-8"); echo $data 1. " \ t "; echo "World". " \ t "; echo "\t\n"; /*start of second line*/echo "This was second line". " \ t "; echo "Hi,pretty girl". " \ t "; echo "\t\n";?>
Summary: the above is the entire content of this article, I hope to be able to help you learn.
Related recommendations:
PHP example analyzes the use of MySQL transaction processing skills
PHP-based multithreading for multi-threaded crawling
PHP creates linked lists and adds, deletes, updates, and loops for linked list nodes