手机
当前位置:查字典教程网 >编程开发 >php教程 >php类
php类
摘要:

<?php

/*----------------------------------------------------------------//

*Class::Ini

*Function::toinstallthesystemwhichisrequestedfromclient

*Author::Kevin#

*QQ::84529890

*Date::2006.10.24

//----------------------------------------------------------------*/

require_once(CLASS_SYS_PATH."class.db.php");

classIni{

/*

*membervariable$defaultPlay

*tosetthevariableplay

*/

var$defaultPlay="main";

/*

*membervariable$DB

*tosettheobject:database

*/

var$DB;

/*

*membervariable$play

*recordtheparameterofplay

*/

var$play;

//////@@@@MEMBERFUNCTIONLIST@@@@

//-======================================-

//LastModifyTime::2006.11.16

//-======================================-

////////////////////////////////////////////

/*

*function::setDB($db)

*settheglobaldatabaseobject

*/

functionsetDB($db){

return$this->DB=$db;

}

/*

*function::loadSystem($play)

*loadsystem

*/

functionloadSystem($play){

if($this->isValidPlay($play)){

require_once("class.smarttemplate.php");

require_once($play);

$playLikeABird=newMain;

}else{

$this->halt("InvalidAccess....");

}

}

/*

*function::iniCon()

*installdatabase

*/

functioniniCon(){

global$DB;

$DB=newDB(HOST_ADDR,HOST_USER,HOST_PSW,DB_NAME);

}

/*

*function::getDB()

*togetthecurrentdatabaseobject

*/

functiongetDB(){

return$this->DB;

}

/*

*function::getPlay()

*gettheplaywhichispostfromclient

*/

functiongetPlay(){

return$play=empty($_REQUEST["play"])?$this->defaultPlay:$_REQUEST["play"];

}

/*

*function::isValidPlay($play)

*tochecklegitimacyiftheplayparameteris

*/

functionisValidPlay($play){

if(file_exists($play)){

returntrue;

}else{

returnfalse;

}

}

/*

*function::halt($msg)

*showmessageonthebrowser

*/

functionhalt($msg){

echo"<fontcolor="#FF0000">".$msg."</font>n<br/>";

}

/*

*function::iniSystem()

*installsystem

*/

functioniniSystem(){

$this->iniCon();

$this->setDB($DB);

$play=$this->getPlay();

return$play=$this->resetPlay($play);

}

/*

*function::resetPlay($p)

*tore-definetheplay'sparameter

*/

functionresetPlay($p){

return$p=CLASS_PATH.ENTRY_FIRST_FORMAT.$p.ENTRY_LAST_FORMAT;

}

/*

*function::Ini()

*tolinkthedatabaseandgettheplaywhichpostfromclient

*/

functionIni(){

$play=$this->iniSystem();

$this->Debug($play);

$this->loadSystem($play);

$this->close();

}

/*

*function::debug($play)

*toshowthedebuginformation

*/

functiondebug($play){

if(DEBUG)$this->halt("Play->$play");

}

/*

*function::close()

*unsetdatabase

*/

functionclose(){

return$this->DB=NULL;

}

///////@@@@@@@@@@@@@@@@@@@@@@@@@defineclassover@@@@@@@@@@@@@@@@@@@@@@@@@

}

?>

【php类】相关文章:

php FPDF类库应用实现代码

精美漂亮的php分页类代码

php实现RSA加密类实例

php判断变量类型常用方法

php 类自动载入的方法

php编写的一个E-mail验证类

php遍历CSV类实例

php文件操作相关类实例

php win下Socket方式发邮件类

常用的php对象类型判断

精品推荐
分类导航