M
M
m0dE2016-04-09 16:03:22
PHP
m0dE, 2016-04-09 16:03:22

Why might the header not work?

Good afternoon!
There is an intermediate page to account for clicks on a previously generated link, when you click on it, a flag about the transition is set. So there is a difference between requests and transitions (out of 50 requests with transitions of approximately links, 7 links are not marked as "transition").
There are no errors in the server logs, databases. At the request and at the transition, logs are written at the very beginning. The link request happens through CURL. Link received, do:

header('Location: '.$url);
die();

On the client side, such links are all written to the logs. On the server side, it does not even get into the method call start log, where it should be marked with a "transition". I can't figure out why. There are no errors associated with this anywhere (I'm talking about logs).
What can be the assumptions?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Ninazu, 2016-04-13
@Ninazu

If there was some kind of data output before the header was displayed, the header will not work. Make sure that before setting the header there was no echo, print_r, var_dump and other output functions. If the file is included, check also in the parent file. Also check that the file is not saved using BOM. If
error_reporting(E_ALL) is set, then some notice may fall, which is also an output . It
will not work.

<html><body>
<?php
header('Location: '.$url);
die();

Will not work
<?php
echo "123";
header('Location: '.$url);
die();

Will not work
{ПРОБЕЛ, ТАБУЛЯЦИЯ ИЛИ ДРУГОЙ СИМВОЛ}<?php
header('Location: '.$url);
die();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question