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!

  • 相关阅读:
    RBAC-基于角色的访问控制
    django缓存机制
    drf JWT认证
    drf自动生成接口文档
    drf多表断表操作
    drf过滤排序分页异常处理
    drf认证权限频率
    drf路由组件
    drf视图组件
    drf请求与响应
  • 原文地址:https://www.cnblogs.com/zcy_soft/p/1859624.html
Copyright © 2011-2022 走看看