php中table导出为Excel

public function save_as_excel($f3){
		$filename = 'report';
		header("Content-type: application/vnd.ms-excel");
		header("Content-Disposition: attachment;Filename=".$filename.".xls");
		echo "<html>";
		echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
		echo "<body>";
		echo stripslashes($_POST['data']);
		echo "</body>";
		echo "</html>";

	}

以上代码摘自opencar的一个插件,很有参考性,我认为可以扩展为直接导出数据库内容作为报表而不用第三方报表控件。

猜你喜欢

转载自blog.csdn.net/liangyely/article/details/82907710
今日推荐