ZF Include path

后端 未结 2 1618
再見小時候
再見小時候 2021-01-15 20:16

Is it correct to require_once? where and how would you put it include path?

Should it not be in a application.ini or bootstrap?

EXAMPLE:

req         


        
2条回答
  •  有刺的猬
    2021-01-15 20:33

    It is not correct in this case.

    First off, please use Zend Tool. It will create the files you don't know how to create yourself. It will create the correct class names, extend them appropriately and require_once anything that might be needed.

    Do not place require_once in the bootstrap. You want it to execute only when needed, not with every request.

    As for the example you've provided, the correct version would be:

    require_once "Zend/View/Interface.php";
    class Zend_View_Helper_Foo extends Zend_View_Helper_Abstract {
    }
    

    The class that is extended by the helper is autoloaded and putting it in require_once does nothing.

提交回复
热议问题