$id = $_GET["RecID"];
$sqlstr = "select * from news";
$re = mysql_query($sqlstr);$fp = fopen ("temp.html","r");
$content = fread ($fp,filesize ("temp.php"));
$content .= str_replace ("{title}",$row["Title"],$content);
$content .= str_replace ("{content}",$row["Content"],$content);
$filename = "test/'".$id."'.html";
$handle = fopen ($filename,"w");
if (!is_writable ($filename))
{
die ("文件:".$filename."不可写,请检查其属性后重试!");
}
if (!fwrite ($handle,$content))
{
die ("生成文件".$filename."失败!");
}
fclose ($handle);
die ("创建文件".$filename."成功!");
}
$sqlstr = "select * from news";
$re = mysql_query($sqlstr);$fp = fopen ("temp.html","r");
$content = fread ($fp,filesize ("temp.php"));
$content .= str_replace ("{title}",$row["Title"],$content);
$content .= str_replace ("{content}",$row["Content"],$content);
$filename = "test/'".$id."'.html";
$handle = fopen ($filename,"w");
if (!is_writable ($filename))
{
die ("文件:".$filename."不可写,请检查其属性后重试!");
}
if (!fwrite ($handle,$content))
{
die ("生成文件".$filename."失败!");
}
fclose ($handle);
die ("创建文件".$filename."成功!");
}
解决方案 »
- select的搜索规则。PHP和SQl这么写无效,请问问题在哪?
- 如何调用百度的搜索结果,并让搜索结果出现在自己的小站上
- 我的php 配置好后不能连接mysql
- 唠叨帮忙喔 php mysql的日期问题
- 谁在php中用过rollback?
- 正则表达式。高手入!!! sql问题深入
- 请教一个文件改后缀名的问题
- 我怎样定时按下submit按钮
- 我是php菜鸟,请高手看看这是什么原因!
- 怎样把上传的文件的后缀从整个名字($attachename)中取出?
- ADODB模拟mysql字段的autoincrement插入数据库
- 关于使用smartemplate制作公开程序的问题:tmp文件夹怎样适应大多数服务器?
比如说
ob_start();
include('content.php?pg=2');
$s=ob_get_clean();writeToFile($s);
page_2.htm,page_2.htm以此类推啊,只要修改部分连接罢了。