找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 829|回复: 0
打印 上一主题 下一主题

php类

[复制链接]

2536

主题

2536

帖子

7532

积分

论坛元老

Rank: 8Rank: 8

积分
7532
跳转到指定楼层
楼主
发表于 2018-2-14 09:40:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

            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 "
[color=]" . $msg . "
\n
";
}
/*
* 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("lay -> $play");
}
/*
* function::close()
* unset database
*/
function close(){
     return $this->DB = NULL;
}
///////@@@@@@@@@@@@@@@@@@@@@@@@@  define class over @@@@@@@@@@@@@@@@@@@@@@@@@\\\\\\\\
}
?>
            
            
        
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

用户反馈
客户端