<?php
if(@$_GET[id]!='')
{
include('word_fun.php');
$word=new word();//示例化对象
$word->start();//定义要保存数据的开始
}
include('word_show.php');
if(@$_GET[id]!='')
{
$word->save('word_c.doc');//定义要保存数据的结束,同时把数据保存到word中
}
if(@$_GET[id]=='')
{
//超链接中的x仅仅是为了传一个值,确认下载,没有其他的实际yi
?>
<a href="#"><div onclick="window.location.href='word_con.php?id=x'">点击跳到下载页面</div></a>
<?php
}else{
echo "<a href=\"word_c.doc\">下载</a>";
}
?>
<?php
class word
{
function start() //定义要保存数据的开始
{
ob_start(); //开始输出缓冲
//设置生成word的格式
print '<html xmlns="urn:schemas-microsoft-comfficeffice"
xmlns:w="urn:schemas-microsoft-comffice:word"
xmlns="http://www.w3.org/TR/REC-html40">';
}
function save($path) //定义要保存数据的结束,同时把数据保存到word中
//所要保存的数据必须限定在该类的start()和save()之间
{
print "</html>";
$data=ob_get_contents(); //返回内部缓冲的内容 即把输出变成字符串
ob_end_clean(); //结束输出缓冲,清洁(擦除)输出缓冲区并关闭输出缓冲
$this->wirtetoword($path,$data);
}
function wirtetoword($fn,$data) //将数据已二进制的形式保存到word中
{
$fp=fopen($fn,"wb");
fwrite($fp,$data);
fclose($fp);
}
}
?>
<?php
include('conn.php'); //连接数据库
$sq="select zf_content from zf where `zf_id`=137";
$sql=mysql_query($sq);
while(($que=mysql_fetch_array($sql))!=false)
{
echo "<font color=\"red\">hahaahahha</font>";
echo $que['zf_content'];
}
?>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有