【PHP类的静态成员变量跟普通成员变量对比】教程文章相关的互联网学习教程文章

smarty生成静态页面的方法

示例代码: require(libs/Smarty.class.php); $tpl=new Smarty(); $tpl->template_dir=./templates/; $tpl->compile_dir=./templates_c; $tpl->config_di示例代码: require(libs/Smarty.class.php); $tpl=new Smarty(); $tpl->template_dir=./templates/; $tpl->compile_dir=./templates_c; $tpl->config_dir=./config/; $tpl->cache_dir=./cache/; $tpl->left_delimiter=<{; $tpl->right_delimiter=}>; ob_start(); //打开输出缓...

php用静态类实现的页面跳转

/** * Miscellaneous utility methods. */final class Utils { private function __construct() { }/** * Redirect to the given page. * @param type $page target page * @param array $params page parameters */ public static function redirect($page, $sub_page = null, array $params = array()) { header('Location: ' . self::createLink($page, $sub_page, $params)); die(...

php生成静态页面的方法(三个函数)

/** 创建目录*/function makedir($mudir){$file = "./$mudir";@mkdir($file,0777);}/**先创子摸板文件路径*/function writemod($filemodname) {$fp=fopen("showmod.shtml","r");$str=fread($fp,filesize("showmod.shtml"));fclose($fp);$fp=fopen($filemodname,"w");fwrite($fp,$str);fclose($fp);}/**更新各自的子摸板文件//$modfile是子摸板名字*/function writeweb($content,$web,$modfile){$fp=fopen($modfile,"r");$str=fread...

php写的一个生成静态页面的类

/** 功能:生成静态页面 整理:脚本学堂 bbs.it-home.org 日期:2013-2-16*/class html{var $dir; //dir for the htmls(without/)var $rootdir; //root of html files(without/):htmlvar $name; //html文件存放路径var $dirname; //指定的文件夹名称var $url; //获取html文件信息的来源网页地址var $time; //html文件信息填加时的时间var $dirtype; //目录存放方式:year,month,,,,var $nametype; //html文件命名方式:namefuncti...

php生成静态页面函数(php2html)的例子

/**------------------------Function: php2html($in_Url, $out_htmlFile, $out_logFile)------------------------@ Description: 生成静态函数@ Copyright: Copyright (c) 2006 - 2011@ Create: 2006-08-01@ Modify: 2013-02-16@ 提示:路径为服务器绝对路径; 若给定的路径目录不存在则自动创建@ Example:php2html("http://bbs.it-home.org", "/www/html/index.html", "/www/log/log.txt");*/// {{{ contentsfunction php2html($i...

虚拟主机上定时自动生成静态页面的方法

$nowtime=time();$pastsec = $nowtime – $_GET["t"];if($pastsec{exit; //1分钟更新一次,时间可以自己调整}ob_start(); //打开缓冲区include(”index.php”);$content = ob_get_contents(); //得到缓冲区的内容$content .= “n”; //加上调用更新程序的代码file_put_contents(”index.html”,$content);if (!function_exists(”file_get_contents”)){function file_get_contents($fn,$fs){$fp=fopen($fn,”w+”);fputs($fp,$fs)...

php生成html静态页面的方法参考

//////////// 张树林 - 慧佳工作室//// Module Name: woods-bhtml.php// Abstract: 生成静态HTML处理程序尾底// Version: 2.0// 版权 1001-1006,慧佳工作室所有版权保护//The software for free software, allowing use, copy,//modify and distribute the software and files. Any//use of this software must place a copy of all the//above copyright notice. By the software Huijia studio//maintenance, if you have any q...

将数据库中的所有内容生成html静态页面的代码

require_once("conn.php");if($_GET['all']){/*获取数据库记录,以便于生成html文件有个文件名*/$sqlquery = "select * from $tbname";$result = mysql_query($sqlquery,$conn)or die("查询失败!");$fp = fopen("./template/article.html",r);$fpcontent = fread($fp,filesize("./template/article.html"));fclose($fp);/*写入文件*/while($row = mysql_fetch_array($result)){$fpcontent = str_replace("{thetitle}",$row['title'...

php生成静态文件的二种方法

ob_start();#开启服务器缓存include_once 'Index.php';$ctx=ob_get_contents();#获取缓存ob_end_clean();#清空缓存$fh=fopen("index.html","w+");fwrite($fh,$ctx);#写入html,生成htmlfclose($fh);?>方法2:php 静态文件生成类class CreateHtml{function mkdir( $prefix= 'article' ){$y = date('Y');$m = date('m');$d = date('d');$p=DIRECTORY_SEPARATOR;$filePath='article'.$p.$y.$p.$m.$p.$d;$a=explode($p,$filePath);fore...

php生成静态页面的详细教程

{ title }this is a { file } files templets PHP处理:templetest.php$title = "测试模板";$file = "TwoMax Inter test templet,author:Matrix@Two_Max"; $fp = fopen ("temp.html","r");$content = fread ($fp,filesize ("temp.html"));$content .= str_replace ("{ file }",$file,$content);$content .= str_replace ("{ title }",$title,$content);echo $content;?>   模板解析处理,即将经PHP脚本解析处理后得出的结果填充...

php生成静态页面的三种方法与代码详解

ob_start();@readfile("http://bbs.it-home.org/");$text = ob_get_flush();$myfile = fopen("myfile.html","w");$text =str_replace ("{counent}",$string,$text);fwrite($myfile,$text);ob_clean();?>因为就算要生成静态页面,动态读取那部分也是要保留的,把数据插入数据库后,把url传递给readfile函数,然后读入缓存,fwrite一下就可以生成静态页面,这个是驼驼最欣赏的一种作法。代码行数最少,效率最高。http://bbs.it-home....

php实现简单的伪静态URL的机制介绍

<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.+) index.php/$1 [L] 上面的代码就是将URL结构导入index.php中,具体的rewrite细节就不赘述了。 2.在PHP中设置一个路由规则配置文件routes.php,我简单的使用了一个hash数组编写规则: /** *路由配置文件编写说明: * 路由配置在一个array...

php使用ftp函数创建目录(生成静态)

/*** desc:create directory through FTP connection* link:bbs.it-home.org* date:2013/02/24*/function FtpMkdir($path, $newDir) { $server='ftp.yourserver.com'; // ftp server $connection = ftp_connect($server); // connection // login to ftp server $user = "me"; $pass = "password"; $result = ftp_login($connection, $user, $pass); // check if connection was made if ((!$conn...

php递归调用与静态变量的使用

//画一个很漂亮的叶子// 定义 PI 一分的角度的值define("PII", M_PI/180);// 新建图像资源,并定义其背景为 白色,前景色为 黑色$im = imagecreate(670,500);$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);$g = imagecolorallocate($im, 0x00, 0x00, 0x00);// 从下面实例化的代码可以得知,初始值 $x, $y, $L, $a 别分为 300, 500, 100, 270function drawLeaf($g, $x, $y, $L, $a) {global $im;$B = 50;$C = 9;$s1 = 2;$s2 ...

php生成静态html文件的原理分析

//引入数据库配置文件include( dirname(dirname(__FILE__))."\include\config.php" );/**** 将数据库中的文章生成单个HTML文件.* @param Date $Date* @param Time $Time* @param String $Content* @param String $Title*/function GenerateHTML($Date,$Time,$Content,$Title,$Name){//将日期、时间变量分解成数组$GetDateRow = explode("-", $Date);$GetTimeRow = explode(":",$Time);//得到文件的名字。比如:20121028210632.html...

成员变量 - 相关标签
静态成员 - 相关标签