Zend framework Zend自动加载在引导中不工作
我正在用zend框架开发一个站点。 我使用自动加载加载类。 它在控制器、模型上工作,但在引导文件中不工作。 为什么? bootstrap.phpZend framework Zend自动加载在引导中不工作,zend-framework,bootstrapping,zend-autoloader,Zend Framework,Bootstrapping,Zend Autoloader,我正在用zend框架开发一个站点。 我使用自动加载加载类。 它在控制器、模型上工作,但在引导文件中不工作。 为什么? bootstrap.php protected function _initAutoload () { // Add autoloader empty namespace $autoLoader = Zend_Loader_Autoloader::getInstance(); $resourceLoader = new
protected function _initAutoload ()
{
// Add autoloader empty namespace
$autoLoader = Zend_Loader_Autoloader::getInstance();
$resourceLoader = new Zend_Loader_Autoloader_Resource(
array('basePath' => APPLICATION_PATH, 'namespace' => '',
'resourceTypes' => array(
'form' => array('path' => 'forms/', 'namespace' => 'Form_'),
'model' => array('path' => 'models/', 'namespace' => 'Model_'),
'plugin' => array('path' => 'plugin/', 'namespace' => 'Plugin_'))));
// viene restituto l'oggetto per essere utilizzato e memorizzato nel bootstrap
return $autoLoader;
}
/**
* inizializza l'autenticazione
*/
protected function _initAuth ()
{
$this->bootstrap("db");
$this->bootstrap("Autoload");
$db = $this->getPluginResource('db')->getDbAdapter();
$adp = new Zend_Auth_Adapter_DbTable($db);
$adp->setTableName(USERS_TABLE)
->setIdentityColumn('username')
->setCredentialColumn('password')
->setCredentialTreatment('sha1(?)');
$storage = new Model_Sessions(false, $db);//line 81
$auth = Zend_Auth::getInstance();
$auth->setStorage($storage);
//$this->bootstrap('log');$log=$this->getResource('log');
if ($auth->hasIdentity()) {
$identity = $auth->getIdentity();
$user = $identity->user_id;
} else
$user = 1;
$user = new Model_user($user);
}
输出误差
致命错误:在第81行的/application/Bootstrap.php中找不到类“Model_Sessions”
在Session.php中
<?php
/**
* @method get($k,$dv=FALSE)
*/
class Model_Sessions implements Zend_Auth_Storage_Interface
{
您的资源自动加载程序看起来不错
我怀疑您想要的是Model\u会话
,而不是Model\u会话
(不是“会话”的小写/大写)
确保类Model\u Sessions
存储在文件application/models/Sessions.php
作为补充说明,您的资源自动加载程序正在查找名称空间前缀为plugins\uuu
的插件。同样,在这里,我怀疑您想要大写的插件