php类
php类
发布时间:2016-12-29 来源:查字典编辑
摘要:

<?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教程学习
编程开发子分类