Warning: unable to change header information - headers already submitted

I get errormessage: Warning: it is not possible to change the header information - the headers already sent (the output starts with C: \ xampp \ htdocs \ json.php: 1)

I know that this errormessage will come if I wrote something and want to send the header information later. But in this case, I do not write anything. Here is my code starting at line 1.

<? header("Content-type: text/html; charset=utf-8");

require ("diplom/includes/php/datenbankfunktionen.php");

$sDB_Server   = "localhost";
$sDB_User     = "root";
$sDB_Password = "";
$sDB_Database = "JSON";

$sSql = "SELECT name, phone, mail as email, contactID AS id FROM contact;";
$aContacts = DB_GetSelectArray($sSql);
echo '{"DATA":'.json_encode($aContacts).',"SUCCESS":true,"ERRORS":[]}';
?>

Can anyone help me out? I am using a developer system with XAMPP.

+3
source share
2 answers

You have utf8 specification

, utf8. , php

ï "¿.

+10

, <? header("Content-type: text/html; charset=utf-8"); .

0

Source: https://habr.com/ru/post/1732322/


All Articles