zoukankan      html  css  js  c++  java
  • Zend_Loader's autoloader deprecated in Zend Framework 1.8

    Zend_Loader's autoloader has been deprecated in the upcoming Zend Framework version 1.8 and so you now get a notice if you use it:

    Notice: Zend_Loader::Zend_Loader::registerAutoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in /www/zf-tutorial/library/Zend/Loader.php on line 207

    Notice: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in /www/zf-tutorial/library/Zend/Loader.php on line 186

    Notice: Zend_Loader::Zend_Loader::autoload is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead in /www/zf-tutorial/library/Zend/Loader.php on line 186

    (and so on)

    This is because you have the lines:

    require_once 'Zend/Loader.php';Zend_Loader::registerAutoload();

    (or similar) somewhere in your bootstrap system.

    The easiest solution is to change them to:

    require_once 'Zend/Loader/Autoloader.php';
    $loader Zend_Loader_Autoloader::getInstance();
    $loader->registerNamespace('App_');

    Where 'App_' is the name of a directory on your include path that has classes within it that follow the Zend Framework naming convention, so change it as appropriate and add more if you need them.

    If you need generic autoloading ability, for instance because your models directory is on your include path and you don't namespace your model classes, then add this:

    $loader->setFallbackAutoloader(true);

    You should also add:

    $loader->suppressNotFoundWarnings(false);

    when in development mode as then the new autoloader will actually tell you what the syntax error is rather than showing you a white page :)

    Now you should go and read the Zend_Loader_Autoloader documentation to learn how very useful it is!

    Update: You should also read Matthew's article on Zend_Loader_Autoloader as it explains this all in detail!

  • 相关阅读:
    Go语言实现:【剑指offer】复杂链表的复制
    Go语言实现:【剑指offer】字符串的排列
    Go语言实现:【剑指offer】机器人的运动范围
    Delphi10.3的DBGrid美化(03)
    uniGUI学习之uniButton设置图标+扁平化CSS(34)
    UniGUI学习之hBox布局(33)
    Bug集锦
    ImageNamed、imageWithContentsOfFile、SupportingFiles、Images.xcassess
    MVC设计模式
    [转]iOS开发之视图控制器(UIViewController)
  • 原文地址:https://www.cnblogs.com/zcy_soft/p/1859624.html
Copyright © 2011-2022 走看看