ここで定義されているクラスライブラリがあります.../projectname / library / Me / Myclass.phpは次のように定義されています:
<?php
class Me_Myclass{
}
?>
私は次のブートストラップを持っています:
<?php
/**
* Application bootstrap
*
* @uses Zend_Application_Bootstrap_Bootstrap
*/
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
/**
* Bootstrap autoloader for application resources
*
* @return Zend_Application_Module_Autoloader
*/
protected function _initAutoload()
{
$autoloader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'Default',
'basePath' => dirname(__FILE__),
));
$autoloader->registerNamespace('Me_');
return $autoloader;
}
/**
* Bootstrap the view doctype
*
* @return void
*/
protected function _initDoctype()
{
$this->bootstrap('view');
$view = $this->getResource('view');
$view->doctype('XHTML1_STRICT');
}
/**
* Bootstrap registry and store configuration information
*
* @return void
*/
protected function _initRegistry()
{
$config = new Zend_Config_Ini(APPLICATION_PATH .
'/configs/application.ini', APPLICATION_ENV,
array('allowModifications'=>true));
Zend_Registry::set('configuration', $config);
}
}
私のコントローラーでは、次のようにクラスをインスタンス化しようとしています。
<?php
class SomeController extends Zend_Controller_Action
{
public function indexAction()
{
$classMaker=new Me_Myclass();
}
}
?>
http:/something.com/projectname/some?id = 1に直接移動すると、次のエラーが発生します。
致命的なエラー:クラス'Me_Myclass'が行xの/home/myuser/work/projectname/application/controllers/SomeController.phpに見つかりません
何か案は?
潜在的に適切なその他:
オートローダーは、application/libraryの下の他のフォルダーで定義したクラスでモデルを拡張しているときに機能するようです。
誰かが「デフォルト」を変更することを提案しましたが、それは問題を修正するようには見えず、この名前空間を使用するモデルの機能を壊すという追加の悪影響がありました。