php类

所属分类: 网络编程 / PHP编程 阅读数: 440
收藏 0 赞 0 分享
<?php
/*----------------------------------------------------------------//
 * Class::    Ini
 * Function:: to install the system which is requested from client     
 * Author::   Kevin#    
 * QQ::       84529890
 * Date::     2006.10.24
//----------------------------------------------------------------*/
 require_once( CLASS_SYS_PATH . "class.db.php");
 class Ini {
 /*
 * member variable $defaultPlay
 * to set the variable play 
 */
 var $defaultPlay = "main";
 /*
 * member variable $DB
 * to set the object : database
 */
 var $DB;
 /*
 * member variable $play
 * record the parameter of play
 */
 var $play;
//////@@@@ MEMBER FUNCTION LIST @@@@\\\\\\\
//-======================================-\\
//      LastModifyTime::2006.11.16 
//-======================================-\\
////////////////////////////////////////////
 /*
 * function :: setDB($db)
 * set the global database object
 */
 function setDB($db){
     return $this->DB = $db;
 }
 /*
 * function::loadSystem($play)
 * load system
 */
 function loadSystem($play){
     if( $this->isValidPlay($play) ){
      require_once("class.smarttemplate.php"); 
  require_once( $play ); 
  $playLikeABird = new Main;
 }else{
     $this->halt("Invalid Access....");
 }
 }
 /*
 * function:: iniCon()
 * install database
 */
 function iniCon(){
     global $DB;
 $DB = new DB( HOST_ADDR , HOST_USER , HOST_PSW , DB_NAME );
 }
 /*
 * function::getDB()
 * to get the current database object
 */
 function getDB(){
     return $this->DB;
 }
 /*
 * function::getPlay()
 * get the play which is post from client
 */
 function getPlay(){
     return $play = empty( $_REQUEST["play"] ) ? $this->defaultPlay : $_REQUEST["play"];
 }
 /*
 * function:: isValidPlay($play)
 * to check legitimacy if the play parameter is 
 */
 function isValidPlay($play){  
 if( file_exists( $play  ) ){
     return true;
 }else{
 return false;
}
 }
 /*
 * function:: halt($msg)
 * show message on the browser 
 */
 function halt($msg){
     echo "<font color=\"#FF0000\">" . $msg . "</font>\n<br />";
 }
 /*
 * function :: iniSystem()
 * install system
 */
 function iniSystem(){
     $this->iniCon();
 $this->setDB($DB);
 $play = $this->getPlay();
 return $play = $this->resetPlay($play);
 }
 /*
 * function :: resetPlay($p)
 * to re-define the play's parameter
 */
 function resetPlay($p){
     return $p = CLASS_PATH . ENTRY_FIRST_FORMAT . $p . ENTRY_LAST_FORMAT;
 } 
 /*
 * function:: Ini()
 * to link the database and get the play which post from client
 */
 function Ini(){
     $play = $this->iniSystem();
 $this->Debug($play);
 $this->loadSystem($play);
 $this->close();
 }
 /*
 * function:: debug($play)
 * to show the debug information
 */
 function debug($play){
     if( DEBUG ) $this->halt("Play -> $play");
 }
 /*
 * function::close()
 * unset database
 */
 function close(){
     return $this->DB = NULL;
 }
 ///////@@@@@@@@@@@@@@@@@@@@@@@@@  define class over @@@@@@@@@@@@@@@@@@@@@@@@@\\\\\\\\
 }
?>
更多精彩内容其他人还在看

php实现在服务器端调整图片大小的方法

这篇文章主要介绍了php实现在服务器端调整图片大小的方法,实例分析了imageResizer与loadimage操作图片的相关技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

php动态绑定变量的用法

这篇文章主要介绍了php动态绑定变量的用法,涉及php变量的判定与动态定义的相关技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

php实现读取和写入tab分割的文件

这篇文章主要介绍了php实现读取和写入tab分割的文件,涉及php文件读写及字符串操作的相关技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

php正则preg_replace_callback函数用法实例

这篇文章主要介绍了php正则preg_replace_callback函数用法,实例分析了preg_replace_callback函数进行正则替换的相关技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

php将字符串随机分割成不同长度数组的方法

这篇文章主要介绍了php将字符串随机分割成不同长度数组的方法,涉及随机数及字符串操作的相关技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

php自动给网址加上链接的方法

这篇文章主要介绍了php自动给网址加上链接的方法,可实现对本文中的网址加上链接的功能,涉及正则匹配的相关技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

php使用socket post数据到其它web服务器的方法

这篇文章主要介绍了php使用socket post数据到其它web服务器的方法,涉及php使用socket传输数据的相关技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

PHP使用递归方式列出当前目录下所有文件的方法

这篇文章主要介绍了PHP使用递归方式列出当前目录下所有文件的方法,涉及php递归操作文件的相关技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

php获取指定范围内最接近数的方法

这篇文章主要介绍了php获取指定范围内最接近数的方法,可实现根据给定区间长度划分各个区间,并在其中寻找与给定数最接近的数,需要的朋友可以参考下
收藏 0 赞 0 分享

php使用ob_flush不能每隔一秒输出原理分析

这篇文章主要介绍了php使用ob_flush不能每隔一秒输出原理,较为详细的分析了php使用ob_flush的相关原理与Linux下使用cli方式的使用方法,需要的朋友可以参考下
收藏 0 赞 0 分享
查看更多