在地址栏输入:localhost或127.0.0.1再加/你的.php文件名
把程序放到你设置的apache的路径下面,
路径可以在apache配置文件httpd.conf中看到,也可以修改
如:
# 文档路径
DocumentRoot "D:/website/phpsite"
# 文档路径权限设置
<Directory "D:/website/phpsite">
这样的话,你就要程序保存为xxx.php后放到D:/website/phpsite/下就行了,路径可以在httpd.conf中修改。
把程序放到你设置的apache的路径下面,
路径可以在apache配置文件httpd.conf中看到,也可以修改
如:
# 文档路径
DocumentRoot "D:/website/phpsite"
# 文档路径权限设置
<Directory "D:/website/phpsite">
这样的话,你就要程序保存为xxx.php后放到D:/website/phpsite/下就行了,路径可以在httpd.conf中修改。
当然还可以在点击下载前判断用户是否登陆,是否有权限,等等
这是以前写过的一段,前面还有一些数据库的操作以及权限判断等等:
$file = fopen("uploads/".$row['f_name'],"rb");
Header("Content-type: image/jpeg");
Header("Accept-Ranges: bytes");
Header("Accept-Length: ".filesize("uploads/" . $row['f_name']));
Header("Content-Disposition: attachment; filename=" . $row['f_name']);
echo fread($file,filesize("uploads/" . $row['f_name']));
fclose($file);