有没有办法使用.htaccess密码保护目录,并记住密码?

我的经验是使用.htAccess密码保护一个目录,它会popup一个模式对话框。 对于某些浏览器(FF和Chrome),不要显示“记住”此密码的checkbox。

有没有办法让密码保护一个目录,并让用户在网页中填写用户名和密码?

或者,有没有办法强制浏览器记住密码?

简短的回答:不

长答案:当服务器发送401 Not Authorized响应代码,然后是WWW-Authenticate: Basic realm="insert realm"头时,浏览器中的对话框将打开。 规范不包含标题来控制对话行为。

要显示一个网页,你需要一点点,并参考你select的编程语言。

没有简单的方法来实现你想要的基于密码的authentication

使用Web应用程序框架..就像Drupal 。 然后把这个放在最上面:

 // initialize Drupal // TODO: adjust path according to placement of script (might need to change to Drupal directory first) require './includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); // check user access rights // TODO: Adjust to the permission you want to restrict to, eg 'access content' or whatever if (!user_access('administer nodes')) { // Insufficient rights, say so drupal_access_denied(); exit(0); } // ... call legacy script 

仅供参考:IT随每个版本而改变。 然后只允许configuration文件或基于其configuration文件名称或用户在该系统,或上面,个人的权限的用户。 https://stackoverflow.com/questions/2496348/checking-drupal-authentication-from-external-php/2499464#2499464

然后使用已经内置的authentication模块,交互,保护等。 负责API的所有繁重和更新。

有负载:Symfony,Magento,Zend … GIYF ..

看一下“Auto Auth”Firefox插件: https : //addons.mozilla.org/en-US/firefox/addon/autoauth/