oop模式
这里有两个点
有个是抽象类和接口,他们区别大于。抽象类可以存有函数体的方法,而接口不可以。
abstract class Top
{
public function getOne();
public function getTwo();
public function getThree()
{
return 300;
}
}
class Top_extend extends Top
{
function getOne()
{
return 100;
}
}
//接口
class interface TopInterface
{
public function getData();
}
class top_interface implements TopInterface
{
}
//$t = new Top(); //抽象类不能被直接实例化
$t = new Top_extend(); //可以通过实例子类2.异常处理
SmartB2B 是一款基于PHP、MySQL、Smarty的B2B行业电子商务网站管理系统,系统提供了供求模型、企业模型、产品模型、人才招聘模型、资讯模型等模块,适用于想在行业里取得领先地位的企业快速假设B2B网站,可以运行于Linux与Windows等多重服务器环境,安装方便,使用灵活。 系统使用当前流行的PHP语言开发,以MySQL为数据库,采用B/S架构,MVC模式开发。融入了模型化、模板
exception.php 异常基类
//异常基类
class LogException extends Exception
{
var $logfile_dir = 'exception.log';
public function __construct($msg=null,$code=0,$file='')
{
if($file == '')
{
$file = $logfile_dir;
}
$this->saveLog($file);
parent::__construct($msg,$code);
}
//记录日志
protected function saveLog($file)
{
file_put_contents($file,$this->__toString(),FILE_APPEND);
}
}databaseErrorMessage = $msg;
parent::__construct($msg,$code);
}
public function getMsg()
{
return $this->databaseErrorMessage;
}
}
?>










