What are the benefits of using headers in php? I am working on rest based web services.
and for JSON what headers are necessary? What are the advantages of headers?
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.
One use can be to tell the browser what kind of media the response is. In your case, you could tell the browser not to cache the response and what kind of media it is.
For exmple :
You can also use header to know what if the request is ajax. Another use which is really important in your case is to know the request type post, get, delete or what have you.