thinkph in the end how to output Excel, little brother quickly crazy
thinkph in the end how to output Excel, the younger brother quickly crazy. Front desk is The Loop output table, name = "List" id = "VO". Click the button, how to make it output to excel in the form of a table, crazy. Great God, come and help.
------Solution--------------------
Try it with a 3rd party class
Http://www.php100.com/html/webkaifa/PHP/PHPyingyong/2009/0114/309.html
------Solution--------------------
What do you mean by passing the table data to the background ~~~~~
What are your tables based on what conditions output, Excel to query the data according to the same criteria is not OK?
------Solution--------------------
This is your third post ....
I'm still this way.
If you don't have any problems, I can use them to further explore.
/**
* Export data as Excel table
[Email protected] $data a two-dimensional array, structured like an array found from a database
[Email protected] $title The first row of Excel header, an array, if empty, no caption
[Email protected] $filename The file name of the download
[Email protected]
$stu = M (' User ');
$arr = select ($stu);
Exportexcel ($arr, array (' ID ', ' account ', ' Password ', ' nickname '), ' filename! ');
*/
function Exportexcel ($data =array (), $title =array (), $filename = ' report ') {
Header ("Content-type:application/octet-stream");
Header ("Accept-ranges:bytes");
Header ("Content-type:application/vnd.ms-excel");
Header ("Content-disposition:attachment;filename=". $filename. ". XLS ");
Header ("Pragma:no-cache");
Header ("expires:0");
Export XLS start
if (!empty ($title)) {
foreach ($title as $k = = $v) {
$title [$k]=iconv ("UTF-8", "GB2312", $v);
}
$title = implode ("\ T", $title);
echo "$title \ n";
}
if (!empty ($data)) {
foreach ($data as $key = = $val) {
foreach ($val as $ck = = $CV) {
$data [$key] [$ck]=iconv ("UTF-8", "GB2312", $CV);
}
$data [$key]=implode ("\ t", $data [$key]);
}
echo implode ("\ n", $data);
}
}
------Solution--------------------
u014244418 users are anxious to die, the answer in the eyes, the landlord can not use