Tag Archives: PHP
使用PHP下载文件
使用PHP下载文件方法很多,比较常用的就是使用函数:readfile。演示代码如下: 代码一: header(‘Content-Description: File Transfer’); header(‘Content-Type: application/octet-stream’); header(‘Content-Disposition: attachment; filename=’.basename($file_path)); 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($file_path)); readfile($file_path); 代码二: $fileinfo = pathinfo($thefile); header(‘Content-type: application/x-’.$fileinfo['extension']); header(‘Content-Disposition: attachment; filename=’.$fileinfo['basename']); header(‘Content-Length: ‘.filesize($thefile)); readfile($thefile); exit;
centos上安装php运行环境(手记)
-, 配置apache 1.关闭防火墙 service iptables stop chkconfig iptables off 2.开启apache service httpd status service httpd start 3.更改http.conf配置 ServerTokens OS –> ServerTokens Prod ServerSignature On –> ServerSignature Off DirectoryIndex index.html index.html.var –> DirectoryIndex index.html index.php 更改管理员邮箱 #ServerName new.host.name:80 –> 根据需要自行修改 Options … Continue reading