Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Zend framework Zend Framework引导函数从何处获取_Zend Framework_Bootstrapping - Fatal编程技术网

Zend framework Zend Framework引导函数从何处获取

Zend framework Zend Framework引导函数从何处获取,zend-framework,bootstrapping,Zend Framework,Bootstrapping,我发现Zend Framework应用程序中的引导类中使用了许多函数 比如: 但我寻找了它的参考资料,但我什么也不喜欢 Zend_Application_Bootstrap_BootstrapAbstract Zend_Application_Bootstrap_Bootstrap 它们都不包含这些函数中的任何一个 在哪里可以找到该函数的完整引用?这些函数没有在任何地方定义,只是在Bootstrap.php中定义,它们被称为资源方法。在引导过程中,ZF自动调用Bootstrap.php中定义的

我发现Zend Framework应用程序中的引导类中使用了许多函数 比如:

但我寻找了它的参考资料,但我什么也不喜欢

Zend_Application_Bootstrap_BootstrapAbstract
Zend_Application_Bootstrap_Bootstrap
它们都不包含这些函数中的任何一个


在哪里可以找到该函数的完整引用?

这些函数没有在任何地方定义,只是在
Bootstrap.php
中定义,它们被称为资源方法。在引导过程中,ZF自动调用
Bootstrap.php
中定义的每个函数,该函数以
\u init
开头

请在此处阅读更多信息:

基本上,它们位于
库/Zend/Application/Resource/
中。您也可以创建自定义的

看看哪个也适合这个

另外,请参见
BootstrapAbstract.php

/**
 * Get class resources (as resource/method pairs)
 *
 * Uses get_class_methods() by default, reflection on prior to 5.2.6,
 * as a bug prevents the usage of get_class_methods() there.
 *
 * @return array
 */
public function getClassResources()
{
    if (null === $this->_classResources) {
        if (version_compare(PHP_VERSION, '5.2.6') === -1) {
            $class        = new ReflectionObject($this);
            $classMethods = $class->getMethods();
            $methodNames  = array();

            foreach ($classMethods as $method) {
                $methodNames[] = $method->getName();
            }
        } else {
            $methodNames = get_class_methods($this);
        }

        $this->_classResources = array();
        foreach ($methodNames as $method) {
            if (5 < strlen($method) && '_init' === substr($method, 0, 5)) {
                $this->_classResources[strtolower(substr($method, 5))] = $method;
            }
        }
    }

    return $this->_classResources;
}
/**
*获取类资源(作为资源/方法对)
*
*默认情况下使用get_class_methods(),反映在5.2.6之前的版本中,
*因为有一个bug阻止使用get_class_方法()。
*
*@return数组
*/
公共函数getClassResources()
{
if(null==$this->\u classResources){
如果(版本比较(PHP版本,'5.2.6')=-1){
$class=新的ReflectionObject($this);
$classMethods=$class->getMethods();
$methodNames=array();
foreach($classMethods作为$method){
$methodNames[]=$method->getName();
}
}否则{
$methodNames=get\u class\u方法($this);
}
$this->_classResources=array();
foreach($methodNames作为$method){
if(5_classResources[strtolower(substr($method,5))]=$method;
}
}
}
返回$this->\u classResources;
}

事实上,正确答案在另一个问题中解释得很好!首先谢谢你。那么,我在哪里可以找到所有的标准资源呢?例如,我需要自定义数据库适配器,我需要自定义布局。。每次我需要这些信息时,我都必须搜索谷歌吗?或者有标准的方法或资源可以使用???@Ahmed我已经更新了答案:资源位于library/Zend/Application/Resource中/
/**
 * Get class resources (as resource/method pairs)
 *
 * Uses get_class_methods() by default, reflection on prior to 5.2.6,
 * as a bug prevents the usage of get_class_methods() there.
 *
 * @return array
 */
public function getClassResources()
{
    if (null === $this->_classResources) {
        if (version_compare(PHP_VERSION, '5.2.6') === -1) {
            $class        = new ReflectionObject($this);
            $classMethods = $class->getMethods();
            $methodNames  = array();

            foreach ($classMethods as $method) {
                $methodNames[] = $method->getName();
            }
        } else {
            $methodNames = get_class_methods($this);
        }

        $this->_classResources = array();
        foreach ($methodNames as $method) {
            if (5 < strlen($method) && '_init' === substr($method, 0, 5)) {
                $this->_classResources[strtolower(substr($method, 5))] = $method;
            }
        }
    }

    return $this->_classResources;
}