0

我下载了完整的zend framework 1.10。解压后,将此文件夹重命名为zf。我将使用 zend 框架作为独立的,只会在需要时调用加载器和包含库。

我把解压后的zend框架放到http://localhost/r/zf

然后从 r/test2.php 我把这些代码做测试调用,但它失败了。

我错过了什么?

<?php
define( 'ROOT_DIR', dirname(__FILE__) );

ini_set('error_reporting', E_ALL | E_STRICT);
ini_set('log_errors',FALSE);
ini_set('html_errors',FALSE);
ini_set('error_log', ROOT_DIR.'/admin/logfile/error_log.txt');
ini_set('display_errors',FALSE);

require_once 'zf/library/Zend/Loader.php';  //successfully go through

echo "aaa";

//It will fail as long as i enable Zend loader lines at below....
//Zend_Loader::loadClass('Zend_Gdata');
//Zend_Loader::loadClass('Zend_Gdata_AuthSub');
//Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
//Zend_Loader::loadClass('Zend_Gdata_Calendar');

echo "bbb";

?>
4

1 回答 1

0

默认情况下,ZF 需要 Zend(即:library/Zend)在您的 include_path 中的某个目录中。

许多 ZF 代码执行以下操作:

require_once 'Zend/Db/Table/Row/Exception.php';

您可以简单地设置 include_path,而无需移动任何文件。加载任何 ZF 文件之前的某个位置:

<?PHP
$path = '/path/to/your/webroot/r/zf/library';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);

You could also copy/move/symlink the Zend directory (the one inside library/) to some place that is already in your include_path. Where that is depends on your platform and setup. Use get_include_path or phpinfo() to figure out where.

于 2010-07-24T23:02:45.833 回答