Re: Re: PHP cannot use a provided class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On March 21, 2018 4:22:10 PM UTC, John Iliffe <john.iliffe@xxxxxxxxx> wrote:
>On Wednesday 21 March 2018 00:58:59 James Moe wrote:
>> 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.
>
>I'm not an expert on PHP by any means but one thing that seems odd to
>me is 
>the mixing of Windows format and Linux format path separators.  Should
>it 
>be "\PHPMailer\PHPMailer"  or "/PHPMailer/PHPMailer" ?  The error
>messages 
>seem to suggest Linux ('/').
>
>John

No, namespaces in php use the backslash, they're not the same as path separators, as path location and namespace don't actually have to be linked (unless you're following psr standards) 
Thanks,
Ash

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux