Skip to main content
Participating Frequently
Dec 12, 2018 3:23 PM UTC
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
    Dec 12, 2018 8:38 PM UTC

    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
    Dec 12, 2018 8:38 PM UTC

    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
    Dec 13, 2018 8:49 AM UTC

    yes of course, it's a .php file

    it must be the version then, thanks

    Translate