discuz!吧 关注:1,020贴子:877
  • 5回复贴,共1

discuz!论坛安装后出现这个错误,要怎么解决?

只看楼主收藏回复

Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in /storage/sdcard0/htdocs/DiscuzX/upload/source/class/class_core.php on line 27


1楼2018-03-08 10:39回复
    同求


    IP属地:河南3楼2018-04-05 15:12
    回复
      PHP 7.2开始不主张使用function __autoload(){}来自动加载类文件。
      __autoload() been DEPRECATED as of PHP 7.2.0. Relying on this feature is highly discouraged.
      请使用spl_autoload_register($callable)来替代__autoload()自动加载函数。其中参数$callable是一个自定义函数。自定义函数的参数为需要加载的类。其他用法和使用__autoload()自动加载函数一样。
      spl_autoload_register()可以注册多个自动加载函数,而使用自动加载函数__autoload()自动加载类时只能写一个__autoload()函数。
      Discuz!使用传统的__autoload()来自动加载类文件,在PHP 7.2中运行需要改为spl_autoload_register()。
      找到文件source\class\class_core.php,用文件编辑软件打开,搜索
      if(function_exists('spl_autoload_register')) {
      spl_autoload_register(array('core', 'autoload'));
      } else {
      function __autoload($class) {
      return core::autoload($class);
      }
      }
      复制代码
      将else部分删除,代码变为
      if(function_exists('spl_autoload_register')) {
      spl_autoload_register(array('core', 'autoload'));
      }
      复制代码
      其实这个if判断也是没有必要的,因为从PHP 5.1开始就已经支持spl_autoload_register()了。


      IP属地:河南4楼2018-04-19 18:35
      回复
        PHP 7.2开始不主张使用function __autoload(){}来自动加载类文件。
        __autoload() been DEPRECATED as of PHP 7.2.0. Relying on this feature is highly discouraged.
        请使用spl_autoload_register($callable)来替代__autoload()自动加载函数。其中参数$callable是一个自定义函数。自定义函数的参数为需要加载的类。其他用法和使用__autoload()自动加载函数一样。
        spl_autoload_register()可以注册多个自动加载函数,而使用自动加载函数__autoload()自动加载类时只能写一个__autoload()函数。
        Discuz!使用传统的__autoload()来自动加载类文件,在PHP 7.2中运行需要改为spl_autoload_register()。
        找到文件source\class\class_core.php,用文件编辑软件打开,搜索
        if(function_exists('spl_autoload_register')) {
        spl_autoload_register(array('core', 'autoload'));
        } else {
        function __autoload($class) {
        return core::autoload($class);
        }
        }
        复制代码
        将else部分删除,代码变为
        if(function_exists('spl_autoload_register')) {
        spl_autoload_register(array('core', 'autoload'));
        }
        复制代码
        其实这个if判断也是没有必要的,因为从PHP 5.1开始就已经支持spl_autoload_register()了。


        IP属地:河南5楼2018-04-19 18:35
        回复
          PHP 7.2开始不主张使用function __autoload(){}来自动加载类文件。
          __autoload() been DEPRECATED as of PHP 7.2.0. Relying on this feature is highly discouraged.
          请使用spl_autoload_register($callable)来替代__autoload()自动加载函数。其中参数$callable是一个自定义函数。自定义函数的参数为需要加载的类。其他用法和使用__autoload()自动加载函数一样。
          spl_autoload_register()可以注册多个自动加载函数,而使用自动加载函数__autoload()自动加载类时只能写一个__autoload()函数。
          Discuz!使用传统的__autoload()来自动加载类文件,在PHP 7.2中运行需要改为spl_autoload_register()。
          找到文件source\class\class_core.php,用文件编辑软件打开,搜索
          if(function_exists('spl_autoload_register')) {
          spl_autoload_register(array('core', 'autoload'));
          } else {
          function __autoload($class) {
          return core::autoload($class);
          }
          }
          复制代码
          将else部分删除,代码变为
          if(function_exists('spl_autoload_register')) {
          spl_autoload_register(array('core', 'autoload'));
          }
          复制代码
          其实这个if判断也是没有必要的,因为从PHP 5.1开始就已经支持spl_autoload_register()了。


          IP属地:河南6楼2018-04-19 18:35
          回复
            PHP 7.2开始不主张使用function __autoload(){}来自动加载类文件。
            __autoload() been DEPRECATED as of PHP 7.2.0. Relying on this feature is highly discouraged.
            请使用spl_autoload_register($callable)来替代__autoload()自动加载函数。其中参数$callable是一个自定义函数。自定义函数的参数为需要加载的类。其他用法和使用__autoload()自动加载函数一样。
            spl_autoload_register()可以注册多个自动加载函数,而使用自动加载函数__autoload()自动加载类时只能写一个__autoload()函数。
            Discuz!使用传统的__autoload()来自动加载类文件,在PHP 7.2中运行需要改为spl_autoload_register()。
            找到文件source\class\class_core.php,用文件编辑软件打开,搜索
            if(function_exists('spl_autoload_register')) {
            spl_autoload_register(array('core', 'autoload'));
            } else {
            function __autoload($class) {
            return core::autoload($class);
            }
            }
            复制代码
            将else部分删除,代码变为
            if(function_exists('spl_autoload_register')) {
            spl_autoload_register(array('core', 'autoload'));
            }
            复制代码
            其实这个if判断也是没有必要的,因为从PHP 5.1开始就已经支持spl_autoload_register()了。


            IP属地:河南7楼2018-04-19 18:35
            回复