【问题标题】:Zend Framework 1.10 custom Class inside library folder not found未找到库文件夹内的 Zend Framework 1.10 自定义类
【发布时间】:2010-08-16 10:36:33
【问题描述】:

我正在从zendCast学习zend框架,找不到问题

我正在使用:

-Zend 服务器 CE

-Zend Studio 7.2

-Zend Framework 1.10(使用zend studio创建)

在我的库文件夹中,我有一个文件夹 App,在该文件夹中有一个 php 文件 Country.php,它对应于 App_Countries 类,但是当我尝试创建一个新的 App_Countries 对象时,它说该类无法加载有关如何加载的任何想法摆脱错误?

Fatal error: Class 'App_Countries' not found in /usr/local/zend/apache2/htdocs/ZC/application/controllers/IndexController.php on line 14

index.php

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
            ->run();

【问题讨论】:

  • 您应该发布您的控制器代码和完整的目录结构。

标签: zend-framework zend-studio zend-server-ce


【解决方案1】:

确保在您的 application.ini 中正确配置了自动加载器命名空间。
它应该包含如下内容:

autoloadernamespaces[] = "Zend"
autoloadernamespaces[] = "App"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-03-16
    • 1970-01-01
    • 2011-02-14
    • 1970-01-01
    • 1970-01-01
    • 2019-01-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多