@Name_23

Fatal error: Namespace declaration statement has to be the very first statement in the script?

Добрый день, у меня ошибка
Namespace declaration statement has to be the very first statement or after any declare call in the script in
1.Все пробелы и код перед тегами удалён
2.Кодировка файла просто UTF-8
Искал решение в Инете, так и не нашёл.
Вот кусок кода
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="refresh" content"-1">
    <title>Document</title>
</head>

<body>
<?php
namespace NS;
    class ShopProduct
    {
     // много кода
    }

    $ShopProduct = new ShopProduct;

    echo "<pre>";
    var_dump($ShopProduct);
    echo "<pre>";

    ?>
</body>

</html>
  • Вопрос задан
  • 83 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы