Zend Framework 1.10 custom Class inside library folder not found

♀尐吖头ヾ 提交于 2019-12-12 05:37:41

问题


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

I'm using:

-Zend Server CE

-Zend Studio 7.2

-Zend Framework 1.10 (created with zend studio)

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

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

回答1:


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

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


来源:https://stackoverflow.com/questions/3492365/zend-framework-1-10-custom-class-inside-library-folder-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!