A
A
Aucuo2020-05-07 01:53:33
PHP
Aucuo, 2020-05-07 01:53:33

Die works after header?

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


Will die work in this case?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SagePtr, 2020-05-07
@Aucuo

It will work, of course. Sending headers does not interrupt script execution. The user just won't see it. Therefore, it is recommended that after sending the redirect, be sure to die and complete the script with the exit / die function so that the underlying code is not executed in vain (if you do not want to continue the script without the user).

F
felony13twelve, 2020-05-07
@felony13twelve

And let's think! You press, say, a button, you are thrown to another page and you think you will see your message? No, you won't see it, the code works from top to bottom

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question