<?php
date_default_timezone_set('PRC');
$html = file_get_contents($_SERVER['DOCUMENT_ROOT'].'/template.tpl');
$title = '新闻';
$header = '新闻内容';
$content = '我中大奖了';
$html = preg_replace('/\{\$title\}/', $title, $html);
$html = preg_replace('/\{\$header\}/', $header, $html);
$html = preg_replace('/\{\$content\}/', $content, $html);
//print $html;
//静态化页面
$path = $_SERVER['DOCUMENT_ROOT'].'/static/'.date('YmdHis').'.html';
$fp = fopen($path, 'wb');
fwrite($fp, $html);
fclose($fp);
浏览器会这么报错
帮忙看看哪里不对?
你看看这个文件的目录存在不存在,不存在的话先创建目录
温馨提示:答案为网友推荐,仅供参考