I am getting the following error:
Warning: Cannot modify header information - headers already sent by..
Apparently the output is started from line 3 and cannot modify from line 11.
<html>
<body>
<?php
use google\appengine\api\users\User;
use google\appengine\api\users\UserService;
$user = UserService::getCurrentUser();
if ($user) {
echo 'Hello, ' . htmlspecialchars($user->getNickname());
}
else {
header('Location: ' . UserService::createLoginURL($_SERVER['REQUEST_URI']));
}
?>
Any ideas how to solve this?