user198729
user198729

Reputation: 63656

How to check whether header() has been set in PHP?

Is there possible whether there are some header information set so far in PHP?

Upvotes: 5

Views: 6561

Answers (2)

muxare
muxare

Reputation: 188

Try using header_list() to determine what headers are ready to be sent to the client. Use headers_sent() to check if headers have been sent to the client.

Upvotes: 5

Josh K
Josh K

Reputation: 28883

Try headers_sent().

PHP docs on headers_sent().

You can also retrieve the headers for a page with get_headers() and list them with headers_list(). I'm a bit confused though, do you mean you want to check if something like header("Location: /path/to/location"); has been called?

Upvotes: 9

Related Questions