用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2213|回复: 2
收起左侧

[内核] ci类库怎么继承类库?

[复制链接]
发表于 2016-3-23 14:39:37 | 显示全部楼层 |阅读模式
两个类库都是自定义的类库
在 ./application/libraries  下新建了两个文件  Father.php Son.php
然后让 son 继承father  我先上代码:

Father.php代码:
<?php
class Father{

    public function edit(){
        echo 'father/edit';
    }
}
?>


Son.php
<?php
class Son extends Father{

    public function index() {
        echo 'son/index';
    }
}
?>


这样写继承,在调用的时候会出错。
我应该怎么写?
发表于 2017-3-24 17:29:16 | 显示全部楼层
为什么要类库继承?
发表于 2018-5-7 11:46:02 | 显示全部楼层
你怎么调用的?

本版积分规则