在库文件夹中找不到Zend Framework 1.10自定义类 [英] Zend Framework 1.10 custom Class inside library folder not found

查看:97
本文介绍了在库文件夹中找不到Zend Framework 1.10自定义类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm learning zend framework from zendCast and can't find the problem

我正在使用:

-Zend Server CE

-Zend Server CE

-Zend Studio 7.2

-Zend Studio 7.2

-Zend Framework 1.10(由zend studio创建)

-Zend Framework 1.10 (created with zend studio)

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

In my library folder I have a folder App and in that folder a php file Countries.php which corresponds to App_Countries class but when I try to create a new App_Countries object it says that class could not be loaded any ideas on how to get rid of the error?

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

index.php

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();

推荐答案

确保在您的application.ini中正确配置了autoloader命名空间.
它应包含以下内容:

Make sure the autoloadernamespace is properly configured in your application.ini.
It should contain something like this:

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

这篇关于在库文件夹中找不到Zend Framework 1.10自定义类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆