php设置请求头
可以使用PHP的header()函数来设置请求头,例如:
设置Content-Type为application/json:
header('Content-Type: application/json');
设置Cache-Control为no-cache:
header('Cache-Control: no-cache');
设置自定义的请求头:
header('X-Custom-Header: value');
注意:header()函数必须在任何输出之前调用,否则会报错。
原文地址: https://www.cveoy.top/t/topic/0vV 著作权归作者所有。请勿转载和采集!