PHP 常用

1, 跳转

header("Location: abc.php");exit;
2.文件下载

$filepath = (you file path); //$_SERVER['DOCUMENT_ROOT']
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($filepath));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: '.filesize($filepath));
readfile($filepath); [更多...]