apache可以设置文件夹权限,这样就不用进行session验证 首先windows和linux原理是一样的 D:/xampp/apache/bin>htpasswd.exe -c D:/www/password.txt yuan 多个用户 D:/xampp/apache/bin>htpasswd.exe D:/www/password.txt yuan1 密码 密码确认 http.conf 添加两行 LoadModule dav_module modules/mod_dav.so LoadModule dav_fs_module modules/mod_dav_fs.so ============================== <Directory "D:/www/smarty/auth"> AllowOverride All Options Indexes Order allow,deny Allow from all Authname "give your name and password" AuthType Basic Require valid-user AuthUserFile D:/www/password.txt </Directory> ok!