$this->a->b->c->d 从 php 中的超类调用方法
我在这个链接上问了一个问题我对这个技术有问题我可以从一个类中调用子类
像这样
$chesterx->db->query();
我想从子班再上一班
例如
我想查询来自 sql 类的执行
ROOT
|
sql <--- chesterx ---> db
我想使用 db 中的 sql 类
我无法从 db 类返回chesterx 类的问题
/编辑/
我有一些类,如新闻、成员、类别、数据库和查询
我喜欢主题顶部的链接
公共函数 __construct(){
function __construct(){
if(!$this->db){
include(ROOT."/func/class/bp.db.class.php");
$this->db = new db;
}
if(!$this->chester){
include(ROOT."/func/class/bp.chester.class.php");
$this->db = new chester;
}
}
我用这段代码调用了 db 类,现在我可以很好地调用和使用 db 类方法
例如
我想使用 db 的方法
该方法包含一个从chester 类的方法返回数据的值
我希望我能澄清自己/编辑/
有没有办法做到这一点?