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!

  • 相关阅读:
    如何制作对联式广告所需的flash图像文件
    GHOST重装系统详解
    Multipledimensional Vector,C++
    Dvbbs展区图片调用(向上滚动样式)
    fatal error C1001: INTERNAL COMPILER ERROR
    硬盘坏道的探测与恢复
    FreeBSD 使用手册
    全美电影票房排行(截止2010.12.19)
    Linux环境下的C/C+基础调试技术2——程序控制
    在freebsd下安装vim(Debian下类似)
  • 原文地址:https://www.cnblogs.com/zcy_soft/p/1859624.html
Copyright © 2011-2022 走看看