在PHP中发送原生 HTTP header头

通过header content-type设置页面编码为utf-8:

<?php
header('Content-Type: text/html; charset=utf-8');
?>

通过header location设置页面跳转:

<?php
header('Location: https://www.dustit.me/');
?>

页面缓存设置:

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>

 

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据