【发布时间】:2014-09-15 11:37:16
【问题描述】:
我正在尝试使用 Codeigniter Loader 来加载库
$this->load->library();
当我加载多个时它会失败。
application\controllers\news.php
<?php
class News extends CI_Controller {
public function aa() {
echo 'this is aa.<br>';
$this->load->library('bb');
$this->load->library('cc');
$this->bb->call(); // This work fine.
$this->cc->call(); // This will show php error.
}
}
?>
application\libraries\Bb.php
<?
class Bb extends CI_Controller {
public function __construct(){
parent::__construct();
echo 'bb constructed.<br>';
}
public function call(){
echo 'bb function called.<br>';
}
}
?>
application\libraries\Cc.php
<?
class Cc extends CI_Controller {
public function __construct(){
parent::__construct();
echo 'cc constructed.<br>';
}
public function call(){
echo 'cc function called.<br>';
}
}
?>
这是一些屏幕截图:
Codeigniter 版本:2.2.0
PHP 版本:5.2.6
【问题讨论】:
标签: php codeigniter loader