Skip to main content
Participating Frequently
December 12, 2018
Answered

Dreamweaver does not recognize the command "use"

I'm using Phpmailer and these two lines must be the first ones in my PHP script:

use PHPMailer\PHPMailer\PHPMailer;

use PHPMailer\PHPMailer\Exception;

Dreamweaver highlights these lines in red.

I'm using Dreamweaver version 11.0

Many thanks

    This topic is closed to new replies. Start a new post to keep the conversation going.
    Nancy OShea
    Nancy OSheaCorrect answer
    Community Expert
    December 12, 2018

    Are you working with a .php file?  This looks OK to me in Dreamweaver 2019.

    <!doctype html>

    <html>

    <head>

    <meta charset="utf-8">

    <title>Untitled Document</title>

    </head>

    <body>

    <?php

    use PHPMailer\PHPMailer\PHPMailer;

    use PHPMailer\PHPMailer\Exception;

    ?>

    </body>

    </html>

    Nancy O'Shea— Product User & Community Expert

    2 replies

    Nancy OShea
    Community Expert
    Nancy OSheaCommunity ExpertCorrect answer
    Community Expert
    December 12, 2018

    Are you working with a .php file?  This looks OK to me in Dreamweaver 2019.

    <!doctype html>

    <html>

    <head>

    <meta charset="utf-8">

    <title>Untitled Document</title>

    </head>

    <body>

    <?php

    use PHPMailer\PHPMailer\PHPMailer;

    use PHPMailer\PHPMailer\Exception;

    ?>

    </body>

    </html>

    Translate
    Nancy O'Shea— Product User & Community Expert
    Participating Frequently
    December 13, 2018

    yes of course, it's a .php file

    it must be the version then, thanks

    Translate