我想将 mysql 表导出为 pdf 格式。请帮我
我试过这段代码。这是我的代码
我的.php
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("jass12", $con);
$result = mysql_query("SHOW COLUMNS FROM ja");
$i = 0;
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result))
{
@$csv_output .='"'.$row['Field'].'","';
$i++;}
}
$csv_output .= "\n";
$values = mysql_query("SELECT * FROM ja");
while ($rowr = mysql_fetch_row($values)) {
for ($j=0;$j<$i;$j++) {
$csv_output .= $rowr[$j].",";
}
$csv_output .= "\n";
}
@$filename = $file."_".date("d-m-Y_H-i",time());
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: xls" . date("Y-m-d") . ".xls");
header( "Content-disposition: filename=".$filename.".xls");
print $csv_output;
exit;
?>
它会产生错误并作为 xls 文件的输出。
我想获得将数据库文件转换为pdf的确切编码。
请帮我