您好,欢迎访问一九零五行业门户网

php生成html文件的简单例子

$val){ $title = $val[0]; $content = $val[1]; $path = $id.'.htm'; $fp = fopen(jia.htm, r); //打开文件,只读方式 $str = fread($fp, filesize(jia.htm)); //读取文件 $str = str_replace({title}, $title,$str); //将字符串中的内容进行替换 $str = str_replace({content}, $content, $str); fclose($fp); //关闭文件 $fpw = fopen($path, w); //以写入的方式打开文件 fwrite($fpw, $str); //将$str写入文件 fclose($fpw); echo generate successfully!;}?>
复制代码
其它类似信息

推荐信息