php类

5年以前  |  阅读数:666 次  |  编程语言:PHP 

<?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 . "\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("Play -> $play");
    }
    /
  • function::close()
  • unset database
    */
    function close(){
    return $this->DB = NULL;
    }
    ///////@@@@@@@@@@@@@@@@@@@@@@@@@ define class over @@@@@@@@@@@@@@@@@@@@@@@@@\\\\\\\\
    }
    ?>
 相关文章:
PHP分页显示制作详细讲解
SSH 登录失败:Host key verification failed
获取IMSI
将二进制数据转为16进制以便显示
获取IMEI
文件下载
贪吃蛇
双位运算符
PHP自定义函数获取搜索引擎来源关键字的方法
Java生成UUID
发送邮件
年的日历图
提取后缀名
在Zeus Web Server中安装PHP语言支持
让你成为最历害的git提交人
Yii2汉字转拼音类的实例代码
再谈PHP中单双引号的区别详解
指定应用ID以获取对应的应用名称
Python 2与Python 3版本和编码的对比
php封装的page分页类完整实例