看到这个:你需要在库中创建文件Zend.php ,
如下图所示:
并将这段代码过去:
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Zend
{
public function __construct($class = NULL)
{
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . APPPATH . 'libraries');
if ($class) {
require_once (string) $class . EXT;
log_message('debug', "Zend Class $class Loaded");
} else {
log_message('debug', "Zend Class Initialized");
}
}
public function load($sClassName)
{
require_once (string) $sClassName . EXT;
log_message('debug', "-> Zend Class $sClassName Loaded from the library");
}
}
而已。现在从Controller中的方法调用 library 你需要的东西。这里我展示了一个加载Picasa 网络相册的示例。
$this->load->library('zend');
$this->zend->load('Zend/Loader');
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Photos');
Zend_Loader::loadClass('Zend_Http_Client');
用另一个例子来加载 Google Spreedsheet。
$this->load->library('zend');
$this->zend->load('Zend/Gdata/Spreadsheets');
$oSpreadSheet = new Zend_Gdata_Spreadsheets();
$entry = $oSpreadSheet->newCellEntry();
$cell = $oSpreadSheet->newCell();
$cell->setText('My cell value');
$cell->setRow('1');
$cell->setColumn('3');
$entry->cell = $cell;
var_dump( $entry );
有关更多信息,请参阅此