[英]Zend framework : no other Action except index action in the controller is callable
I have a controller file with the two actions ie : 我有两个动作的控制器文件,即:
class IndexController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
// action body
}
public function doLoginAction()
{
// action body
}
}
and their corresponding view files. 及其相应的视图文件。 ie when i hit http://www.mydomain.com/index it loads the index view.
即当我点击http://www.mydomain.com/index时,它将加载索引视图。 The problem I am facing is that when I try to access the index action of this controller it will load the corresponding view but when I try to hit the dologin action it gives the error
我面临的问题是,当我尝试访问此控制器的索引操作时,它将加载相应的视图,但是当我尝试执行dologin操作时,它将给出错误
http://www.mydomain.com/index/dologin http://www.mydomain.com/index/dologin
* Message: Action "dologin" does not exist and was not trapped in __call()* * 消息:操作“ dologin”不存在,也没有被困在__call()*中
Request Parameters: 请求参数:
array (
'controller' => 'index',
'action' => 'dologin',
'module' => 'default',
)
same is happening when I try it with another controller and action. 当我尝试使用另一个控制器和动作时,也会发生同样的情况。 The index action runs fine for that controller too but not any other action in the controller.
index动作对于该控制器也可以正常运行,但不能在该控制器中执行任何其他操作。
PS : I have configured mod_rewrite module and AllowOverride ALL in apache config file PS:我已经在Apache配置文件中配置了mod_rewrite模块和AllowOverride ALL
Camel-cased action names are expected to be dashed as params. 驼峰式动作名称应以破折号形式表示为params。 Therefore, doLoginAction() will respond to /default/index/do-login, not dologin.
因此,doLoginAction()将响应/ default / index / do-login,而不是dologin。 If you wish the URL to be dologin, you should rename the action to dologinAction().
如果希望该URL是dologin,则应将操作重命名为dologinAction()。
You can have hyphen(-) separated urls at controller level also. 您还可以在控制器级别使用连字符(-)分隔的url。
Suppose you need a url like this: 假设您需要这样的网址:
http://www.mydomain.com/do-some-stuff/my-stuff/ http://www.mydomain.com/do-some-stuff/my-stuff/
Then your controller should be named as: 然后,您的控制器应命名为:
DoSomeStuffController (as class name) && DoSomeStuffController.php (as controller file name)
and 和
myStuffAction() (as your method name)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.