PHP读写文件的方法(生成HTML)

所属分类: 网络编程 / PHP编程 阅读数: 1565
收藏 0 赞 0 分享
<?php 
//生成HTML 
$countfile="template.html"; 
$num=file_get_contents($countfile); 
echo $num; 
$num=str_replace("|*|*|PAGE_TITLE|*|*|","myhome",$num); 
$path="template.html"; 
$handle=fopen($path,"w"); //写入方式打开新闻路径 
fwrite($handle,$num); //把刚才替换的内容写进生成的HTML文件 
fclose($handle); 
?> 
file_get_contents -- 将整个文件读入一个字符串
file -- 把整个文件读入一个数组中
更多精彩内容其他人还在看

產生圖片隨機字串

產生圖片隨機字串
收藏 0 赞 0 分享

数字转英文

数字转英文
收藏 0 赞 0 分享

ajax缓存问题解决途径

ajax缓存问题解决途径
收藏 0 赞 0 分享

PHP字符函数大全第1/2页

PHP字符函数大全
收藏 0 赞 0 分享

从网上搜到的phpwind 0day的代码

从网上搜到的phpwind 0day的代码
收藏 0 赞 0 分享

IIS下配置Php+Mysql+zend的图文教程

IIS下配置Php+Mysql+zend的图文教程
收藏 0 赞 0 分享

如何写php程序?

如何写php程序?
收藏 0 赞 0 分享

php中处理模拟rewrite 效果

php中处理模拟rewrite 效果
收藏 0 赞 0 分享

用PHP函数解决SQL injection

用PHP函数解决SQL injection
收藏 0 赞 0 分享

粗略计算在线时间,bug:ip相同

粗略计算在线时间,bug:ip相同
收藏 0 赞 0 分享
查看更多