__autoload() 不再受支持,在 C:\xampp\htdocs\webapp\PHPMailerAutoload.php 第 45 行使用 spl_autoload_register() 代替 [英] __autoload() is no longer supported, use spl_autoload_register() instead in C:\xampp\htdocs\webapp\PHPMailerAutoload.php on line 45

查看:173
本文介绍了__autoload() 不再受支持,在 C:\xampp\htdocs\webapp\PHPMailerAutoload.php 第 45 行使用 spl_autoload_register() 代替的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 phpMailer 来处理从网站发送的邮件.今天早上我突然收到以下消息:

I use phpMailer for the processing of mail sent from the website. This morning I suddenly got the following message:

致命错误:不再支持 __autoload(),在 C:\xampp\htdocs\webapp\PHPMailerAutoload.php 第 45 行使用 spl_autoload_register() 代替

Fatal error: __autoload() is no longer supported, use spl_autoload_register() instead in C:\xampp\htdocs\webapp\PHPMailerAutoload.php on line 45

我在服务器上运行 PHP 8.0.0

I have PHP 8.0.0 running on the server

if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
    //SPL autoloading was introduced in PHP 5.1.2
    if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
        spl_autoload_register('PHPMailerAutoload', true, true);
    } else {
        spl_autoload_register('PHPMailerAutoload');
    }
} else {
    /**
     * Fall back to traditional autoload for old PHP versions
     * @param string $classname The name of the class to load
     */
    function __autoload($classname)
    {
        PHPMailerAutoload($classname);
    }
}

推荐答案

您使用的是非常旧版本的 PHPMailer – 该代码已经 3 年没有出现在 PHPMailer 中了.PHP 8.0 自 PHPMailer 6.2.0 起得到官方支持,请务必阅读升级指南.

You're using a very old version of PHPMailer – that code has not been in PHPMailer for 3 years. PHP 8.0 is officially supported as of PHPMailer 6.2.0, and make sure you read the upgrade guide.

这篇关于__autoload() 不再受支持,在 C:\xampp\htdocs\webapp\PHPMailerAutoload.php 第 45 行使用 spl_autoload_register() 代替的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆