checkpath($this->htemplate,0))
{
return false;
}
//检查新生文件路径是否合法
if(!$this->checkpath($this->htfilepath,1))
{
return false;
}
$fp=fopen($this->htemplate,r); //只读打开模板
$this->strtext=fread($fp,filesize($this->htemplate));//读取模板中内容
fclose($fp);
//替换文件
$this->replacetext();
//生成文件名称
$this->createname();
$handle=fopen($this->filename,w); //写入方式打开新闻路径
fwrite($handle,$this->strtext); //把刚才替换的内容写进生成的html文件
fclose($handle);
return true;
}
function checkpath($pstr,$type)
{
if($type==0)
{
if(!file_exists($pstr))
{
$this->errorstr=文件夹路径有误!;
return false;
}
}else
{
$arrpath = explode (/, $pstr);
$s_path=;
foreach ($arrpath as $tag) {
if($s_path==)
{
$s_path .= $tag;
}else
{
$s_path .=/.$tag;
}