I would like to know if its possible to clear the current information stored in header_list()
if(headers_sent()){
foreach(headers_list() as $header){
header_remove($header);
}
}
var_dump(headers_list());
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
headers_sentindicates that it is too late to remove headers. They’re already sent. Hence the name of the function.What you want is to specifically check if the headers have not been sent yet. Then you know it’s safe to modify them.