- 404:
header ("HTTP/1.1 404 Not Found");
- 301:
header ("HTTP/1.1 301 Moved Permanently"); header ("Location:http://www.baidu.com");
- 下載文件:
header ('Content-type: application/file'); header ("Content-Disposition: attachment; filename='test.file'"); readfile ("test.file");
- 允許跨域:
header('Access-Control-Allow-Origin:*');
- 設置自定義header頭:
header('Access-Control-Allow-Headers:WWW-Authenticate,Authorization,Set-Cookie,X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version,name');
php常見的header操作
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.