Heim  >  Artikel  >  Backend-Entwicklung  >  CodeIgniter一个controller include另一个controller,在实例化时会报错

CodeIgniter一个controller include另一个controller,在实例化时会报错

WBOY
WBOYOriginal
2016-08-04 09:19:021105Durchsuche

<code>Unable to locate the specified class: Session.php
</code>

报以上错误,stackOverflow上有这个问题,他被引用的controller 改为extends CI_Model就行了,但我是本来就要include controller的,没法那么做,请问怎么解决这个问题?


引用和被引用的controller之间,任意一个写上以下代码就不会报错,但只要把调用父类的构造函数那行解除注释,又会报错,这到底是为什么???

<code>
function __construct(){
    //parent::__construct();
}</code>

回复内容:

<code>Unable to locate the specified class: Session.php
</code>

报以上错误,stackOverflow上有这个问题,他被引用的controller 改为extends CI_Model就行了,但我是本来就要include controller的,没法那么做,请问怎么解决这个问题?


引用和被引用的controller之间,任意一个写上以下代码就不会报错,但只要把调用父类的构造函数那行解除注释,又会报错,这到底是为什么???

<code>
function __construct(){
    //parent::__construct();
}</code>

可能是因为你引用的时候相对路径变了吧,话说为什么需要引用controller?

为什么要引用另外个控制器?????

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn