Home > Backend Development > PHP Tutorial > Web development source code: PHP class to generate static pages_PHP tutorial

Web development source code: PHP class to generate static pages_PHP tutorial

WBOY
Release: 2016-07-13 10:58:57
Original
815 people have browsed it

class html
{
var $dir; //dir for the htmls(without/)
var $rootdir; //root of html files(without/):html
var $name; //html file storage path
var $dirname; //Specified folder name
var $url; //Get the source web address of html file information
var $time; //Time to fill in html file information
var $dirtype; //Directory storage method: year, month,,,,
var $nametype; //html file naming method: name

function html($nametype='name',$dirtype='year',$rootdir='html')


function setvar($nametype='name',$dirtype='year',$rootdir='html')


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

if (!is_dir($this->dir))
{
$temp = explode('/',$this->dir);
$cur_dir = '';
for($i=0;$i {
$cur_dir .= $temp[$i].'/';
if (!is_dir($cur_dir))

}
}
}

function getdir($dirname='',$time=0)
{
$this->time=$time?$time:$this->time;
$this->dirname=$dirname?$dirname:$this->dirname;

switch($this->dirtype)
{
case 'name':
if(empty($this->dirname))
$this->dir=$this->rootdir;
else
$this->dir=$this->rootdir.'/'.$this->dirname;
break;
case 'year':
$this->dir=$this->rootdir.'/'.date("Y",$this->time);
break;

case 'month':
$this->dir=$this->rootdir.'/'.date("Y-m",$this->time);
break;

case 'day':
$this->dir=$this->rootdir.'/'.date("Y-m-d",$this->time);
break;
}

$this->createdir();

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631963.htmlTechArticleclass html { var $dir; //dir for the htmls(without/) var $rootdir; //root of html files(without/):html var $name; //html file storage path var $dirname; //Specified folder name...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template