PHP100 2019-03-27
代码如下:
<?php $file_name = urlencode($_REQUEST['filename']); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header('Content-Type: application/vnd.ms-excel; charset=utf-8'); header("Content-Transfer-Encoding: binary"); header('Content-Disposition: attachment; filename='.$file_name); echo stripslashes($_REQUEST['content']); ?>
代码如下:
$filename = "中文.txt"; $ua = $_SERVER["HTTP_USER_AGENT"]; $encoded_filename = urlencode($filename); $encoded_filename = str_replace("+", "%20", $encoded_filename); header('Content-Type: application/octet-stream'); if (preg_match("/MSIE/", $ua)) { header('Content-Disposition: attachment; filename="' . $encoded_filename . '"'); } else if (preg_match("/Firefox/", $ua)) { header('Content-Disposition: attachment; filename*="utf8''' . $filename . '"'); } else { header('Content-Disposition: attachment; filename="' . $filename . '"'); }
代码如下:
<?php $file_name = urlencode($_REQUEST['filename']); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header('Content-Type: application/vnd.ms-excel; charset=utf-8'); header("Content-Transfer-Encoding: binary"); header('Content-Disposition: attachment; filename='.$file_name); echo stripslashes($_REQUEST['content']); ?>
server { listen 80; server_name ××××.com; access_log /×××/×××/nginx/log/access.log; error_log /×××/×
if (!$file = fopen($filename, "rb");Header( "Content-type: application/octet-stream ");Header( "Acce