K
K
khipster2016-03-28 13:00:03
PHP
khipster, 2016-03-28 13:00:03

Do I need to check HTTP headers via isset?

For example these:
$_SERVER['REQUEST_URI'] (this is not an HTTP header, but the question is the same)
$_SERVER['HTTP_ACCEPT_LANGUAGE']
isset($_SERVER['REQUEST_URI'])
isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])
etc. e. can it turn out that they will not be transferred and will be NULL?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Masterov, 2016-03-28
@khipster

Yes, because, depending on the environment, they may not be.
I advise you to read a good guide on using isset and empty, it, among other things, describes your case:
The Definitive Guide To PHP's isset And empty

D
Dave, 2016-03-28
@djay

www.stackoverflow.com/a/12772942/1208233

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question