IIS比较简单,按图中设置就可以了
2. Apache实现方法
方法一
<Directory "/var/www/html/attachments">
<Files ~ ".php">
Order allow,deny
Deny from all
</Files>
</Directory>
方法二
<Directory "/var/www/html/attachments">
php_admin_flag engine off
</Directory>
方法三
在.htaccess中写入
RewriteEngine on RewriteCond % !^$
RewriteRule attachments/(.*).(php)$ - [F]
3. Nginx实现方法
location ~ /attachments/.*.php$ {
deny all;
}