Und*_*e2k 2 php zend-framework codeigniter
所以我正在尝试安装一些Zend Framework组件,因此我可以使用google API picasa库.
我尝试将Zend库添加到我的
codeigniter-> application-> libraries
然后跑步$this->load->library('Zend');但我收到了
无法加载请求的类:zend
然后我试着这样做
$clientLibraryPath = '/usr/local/lib/php/Zend/Gdata';
$oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . $clientLibraryPath);
Run Code Online (Sandbox Code Playgroud)
> Exception thrown trying to access Zend/Loader.php using
> 'use_include_path' = true. Make sure you include Zend Framework in
> your include_path which currently contains:
> .:/usr/share/php:/usr/share/pear:/usr/local/lib/php/Zend/Gdata
Run Code Online (Sandbox Code Playgroud)
我不确定实际路径应该是什么我也将Zend libary上传到users/local/lib/php.我究竟做错了什么?
看到这个:您需要在库中创建文件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");
}
}
Run Code Online (Sandbox Code Playgroud)
而已.现在从Controller中的方法调用库所需的内容.这里我展示一个加载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');
Run Code Online (Sandbox Code Playgroud)
另一个示例是加载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 );
Run Code Online (Sandbox Code Playgroud)
有关更多信息,请参阅此
| 归档时间: |
|
| 查看次数: |
3252 次 |
| 最近记录: |