php静态页面示例,php生成静态页面的简单示例_php实例
发布日期:2021-06-24 10:12:12 浏览次数:4 分类:技术文章

本文共 578 字,大约阅读时间需要 1 分钟。

$title=$_POST["title"];

$content=$_POST["content"];

$num = uniqid();

$houzui=".html";

$filename=date('Ymd').'/'.$num.$houzui;

$sql="insert into news(title,content,path) values ('{$title}' , '{$content}' , '{$filename}')";

$query = $db->query($sql);

$fp=fopen("model.htm","r");

$str=fread($fp,filesize("model.htm"));

$str=str_replace("{title}",$title,$str);

$str=str_replace("{content}",$content,$str);

fclose($fp);

$dir = dirname($filename);

if(!is_dir($dir)){

mkdir($dir);

}

$handle=fopen($filename,"w");

fwrite($handle,$str);

fclose($handle);

echo "查看刚才添加的新闻";

echo "添加新闻";

?>

转载地址:https://blog.csdn.net/weixin_32042443/article/details/115886827 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:迭代函数系统matlab实现,线性随机IFS迭代Matlab示例程序.doc
下一篇:mysql in 逗号分隔,使用MySQL IN()从逗号分隔的值中获取记录?

发表评论

最新留言

逛到本站,mark一下
[***.202.152.39]2024年04月14日 14时29分32秒