#1 541182494
定义了 类 onf为 父类 数据库是模仿wordpress的数据库,配置信息都在config表中存放的。读取以后,循环输出class conf extends spController其他控制器 全部继承 父类,main类
{
//此处就是获得程序的一些配置信息
function __construct(){
// 必须加入启动父类构造函数的操作
parent::__construct();
$configs = spClass("config");
if ($result = $configs->findAll()){
foreach($result as $value){
//关键字
if($value["keyname"] =="keyword"){
$keyword = $value["contet"];
}
//描述
if($value["keyname"] =="describe"){
$describe = $value["contet"];
}
}
//dump( $keyword );
//dump( $describe );
}
}
}
class main extends conf但是问题又出现了,在页面中发现 index 页面无法接收到 父类中的知。我看了例子,但就是没有值。
{
//查询首页需要的文章
function index()
{
//dump($keyword);
//dump($describe);
echo $GLOBALS["keyword"];
//echo $this->$describe;
$this->display('index.html');
}
}
求解,新手 !
2013-02-06 13:27:48