Re: PHP cannot use a provided class
| From: | James Moe | Date: | Wed, 21 Mar 2018 04:58:59 +0000 |
| Subject: | Re: PHP cannot use a provided class | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-326398@lists.php.net to get a copy of this message | ||
On 03/20/2018 03:14 PM, Christoph M. Becker wrote:
>> //Import the PHPMailer class into the global namespace
>> // use PHPMailer\PHPMailer\PHPMailer;
> Either properly import the class:
>
> use PHPMailer\PHPMailer;
>
Using the above causes the script to silently abort. No messages, nothing.
>>
>> $mail = new PHPMailer();
> Or use the fully qualified class name:
>
> $mail = new \PHPMailer\PHPMailer;
>
This yields the message:
Fatal error: Class 'PHPMailer\PHPMailer' not found in
/home/sohne/web/php/common/php-test-email.php on line 44
>
> See also the chapter about namespaces in the PHP manual:
> <http://www.php.net/manual/en/language.namespaces.php>
>
Apparently php.net is having issues. The page persistently times out.
--
James Moe
jmm-list at sohnen-moe dot com
Think.