Welcome Guest, Not a member yet? Register   Sign In
New controller Namespace declaration statement has to be the very first statement or
#1

Hi,

When i create a new controler with vs code and xampp, i have the error "ErrorException #64 Namespace declaration statement has to be the very first statement or after any declare call in the script" line: 3
PHP Code:
<?php

namespace App\Controllers//line 3


class Events extends BaseController
{
    public function index()
    {

    }

Thanks
Reply
#2

Not sure why vs code would be throwing that error, I use phpStorm and have never gotten that error.

try deleting the Controller and recreating it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

space or BOM
Reply
#4

I created the controller without any problems in VS Code using Wamp server 3.2.7.
Reply
#5

remove whitespace before <?php
Reply
#6
Sad 

(04-24-2022, 02:07 AM)iRedds Wrote: space or BOM

Thansk!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB