启用htpasswd的在Zend中,框架项目的特定操作/ URL或控制器控制器、框架、操作、项目

由网友(╰→街角的祝福〞)分享简介:我想用密码保护使用htpasswd的一个Zend-框架项目。我能够让htpasswd的公共/ index.php文件,即项目完全,但我想要实现的是能为特定的控制器/唯一操作密码保护。 I want to use password protection for a zend-framework project usin...

我想用密码保护使用htpasswd的一个Zend-框架项目。我能够让htpasswd的公共/ index.php文件,即项目完全,但我想要实现的是能为特定的控制器/唯一操作密码保护。

I want to use password protection for a zend-framework project using .htpasswd. I am able to enable htpasswd in public/index.php i.e project entirely but what i want to achieve is enable password protection for a particular controller/action only.

我说,我有一个控制器的名字UserController中和行动editUserAction。而另一控制器通过名字PublicController用行动listUserAction。我想实现的是启用UserController中/编辑用户操作密码保护。即当用户试图访问网址:的http://为m​​yhost / MyProject的/用户/编辑用户用户会被提示输入用户名和密码,但URL的其余部分应是可访问的。

Say, I have a controller by name UserController and action editUserAction. And another controller by name PublicController with action listUserAction. What I want to achieve is enable password protection for usercontroller/edit-user action. i.e. whenever a user tries to access url : http://myhost/myproject/user/edit-user User should be prompted for username and password but the rest of the urls should be accessible.

这是可能的???这是使用htpasswd的和.htaccess中的Zend项目???

Is this possible ??? Is this possible using .htpasswd and .htaccess in zend projects ???

推荐答案

查看基本的HTTP验证用PHP:的 http://php.net/manual/en/features.http-auth.php

Check out basic HTTP Authentication with PHP: http://php.net/manual/en/features.http-auth.php

您实际上并不需要使用.htaccess文件,但可以建立密码提示到您的权利控制器。

You don't actually need to use a .htaccess file but can build the password prompt right into your controllers.

阅读全文

相关推荐

最新文章