Home  >  Article  >  Backend Development  >  CI怎么实现间接继承

CI怎么实现间接继承

WBOY
WBOYOriginal
2016-06-13 12:03:131233browse

CI如何实现间接继承
当:
class MY_Controller extends CI_Controller{ .... }

controller文件夹里:
class add_shop extends MY_Controller{....}

这样是一切正常的,能够访问我自定义MY_Controller和框架CI_Contorller的方法和属性

但是,我想实现:
class MY_Controller extends CI_Controller{ .... }
class MY_Shop_Base extends MY_Controller { .... }

controller文件夹里:
class add_shop extends MY_Shop_Base {....}

想这样去间接继承CI_Controller,但是项目就会报错: Fatal error: Class 'MY_Shop_Base ' not found 
------解决方案--------------------
很明显,你在定义 add_shop 时没有载入 MY_Shop_Base 的定义

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn