首页 > 开发 > PHP > 正文

生成静态页面的PHP类

2024-05-04 22:04:50
字体:
来源:转载
供稿:网友

代码如下:<?php 
class html 

    var $dir;        //dir for the htmls(without/) 
    var $rootdir;    //root of html files(without/):html 
    var $name;       //html文件存放路径 
    var $dirname;    //指定的文件夹名称 
    var $url;        //获取html文件信息的来源网页地址 
    var $time;       //html文件信息填加时的时间 
    var $dirtype;    //目录存放方式:year,month,,,, 
    var $nametype;   //html文件命名方式:name 

    function html($nametype='name',$dirtype='year',$rootdir='html') 
    { 
        $this->setvar($nametype,$dirtype,$rootdir); 
    } 

    function setvar($nametype='name',$dirtype='year',$rootdir='html') 
    { 
      $this->rootdir=$rootdir; 
      $this->dirtype=$dirtype; 
      $this->nametype=$nametype; 
    } 

    function createdir($dir='') 
    { 
        $this->dir=$dir?$dir:$this->dir; 

        if (!is_dir($this->dir)) 
        { 
            $temp = explode('/',$this->dir); 
            $cur_dir = ''; 
            for($i=0;$i<count($temp);$i++) 
            { 
                $cur_dir .= $temp[$i].'/'; 
                if (!is_dir($cur_dir)) 
                { 
                @mkdir($cur_dir,0777); 
                } 

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表