我不知道这在库中是否可用,但 FCPATH 通常指向您的 CI 根目录,而 APPPATH 通常指向您的应用程序目录。希望有所帮助,这些设置在 CI 根 index.php 文件中,您可以尝试回显它们以查看它们是否进入库,如果没有在其中添加设置器,例如
/**
* Storage holder for the include files paths, is changed by $this->include_file()
*
* @access protected
*
* @var string
*/
protected $_path;
/**
* Sets the path for include files.
*
* @access private
*
* @param string $path Path of files to include.
*/
private function set_path($path)
{
$this->_path = $path;
}
// ------------------------------------------------------------------------
/**
* Includes file.
*
* @param string $file Filename to include
*
* @return void
*/
function include_file($file)
{
include($this->_path . $file);
}
然后从 CI 范围设置它
<?php
$this->library->set_path(FCPATH);
$this->library->include_file('SI.php');
如果我理解你在寻找什么,这样的事情可能会奏效。