How to send http response header using PHP

Http resonse header is sent to client by web server, we can create a http response header by php and send it to clients’ browsers.

How to create a http response header?

To create a response header, you should konw the response fileds firstly. You can read this article to get detailed filed.

Standard http response fields

How to send http response header to client using php

We can use header() function to send response header. For example

header('Last-Modified: '.gmdate('r',$time));
header('Expires: '.gmdate('r',($time+$interval)));
header('Cache-Control: max-age='.$interval);