草庐IT

action-menu

全部标签

php - Zend Framework Action 被调用两次

我们正在尝试使用zend框架构建应用程序并遇到以下问题:“某些Controller操作被调用两次。这意味着操作被调用,完成其执行然后再次被调用”。我们通过检查日志文件中的条目追踪到了这一点。对于一个请求,日志文件中有2个条目。您知道可能导致此问题的任何原因吗?这个跟FrontController的派发流程有关系吗?问候, 最佳答案 我发现在启用ChromeExtensionWebug(GoogleChrome的FirePHP扩展)时,请求了两次操作。 关于php-ZendFramewor

php - Zend Framework - 如何从 Action 助手中调用 Controller 的 redirect()

我正在ActionHelper的preDispatch方法中进行ACL检查。当它失败时,我想调用ActionController的_redirect方法,但是我很难做到这一点。在这篇文章所附的评论中,zend-framework,callanactionhelperfromwithinanotheractionhelper,我看到两个解决方案。首先,Controller作为$this->_actionController从helper访问。在第二个中,使用$this->getActionController()访问它。我尝试了以下两种方法:$this->_actionControlle

php - 在 Laravel 5/6/7/8/9 中使用表单请求验证时出现错误 "This action is unauthorized."

我做了一些像这样的门:Gate::define('update-post',function($user,Post$post){return$user->hasAccess(['update-post'])or$user->id==$post->user_id;});我检查了我的数据库,它具有更新后访问权限,并且用户ID与帖子中的相同。但我得到了:Thisactionisunauthorized.错误。那我在这里做错了吗?谢谢。 最佳答案 我前段时间在开始使用FormRequest的时候遇到过类似的问题数据验证类。我注意到以下几点:

php - 在 Laravel 4 中获取 Controller 和 Action 名称

我正在尝试访问当前Controller的名称和当前方法,以将其作为变量传递到我的View。我从网上找到的指示中尝试了几种方法,但它们不起作用,所以我认为它们适用于Laravel3。这是我试过的Request::$route->controller给予Accesstoundeclaredstaticproperty:Illuminate\Support\Facades\Request::$route和Request::route()->controller给予CalltoundefinedmethodIlluminate\Http\Request::route()

php - 代替 Form Action 和方法

我发现没有像在中那样的“Action”和“方法”我想在按下按钮提交后获取在文本框中输入的值。我怎样才能像前者一样(获取通过POST或GET提交的值)?此外,如果我想获取URL中传递的值http://localhost/index.php/something?value=75&today=Wed例如,75和Wed。 最佳答案 试试这个:echoform_open('controller/somepage',array('method'=>'get')); 关于php-代替FormActio

php - 覆盖 Magento Action

有很多次我想做的只是覆盖Controller上的特定操作,而不是整个事情。在大多数情况下,我只是覆盖了整个Controller,但我想知道是否有更好的方法?Magento是否有办法只覆盖Controller中的单个操作,而使原始Controller和其他操作保持原样?例子:classMage_Core_AwesomeControllerextendsMage_Core_Controller_Front_Action{//hasurlofawesome/indexpublicfunctionindexAction(){//SomeAwesomecode}//hasurlofawesome

PHP 代码点火器 : set_value on dropdown menu

我有以下View,但如何将set_value应用到它而不默认为Pleaseselect?Type:PleaseSelect">Input">TextArea">RadioButton">CheckBox更新:查看:Placeholder:PleaseSelect">Yes">NoPlaceholderText:">Type:PleaseSelect>Input>TextArea>RadioButton>CheckBoxController:$data['fieldType']=$this->input->get('add_fields_type');$data['placeholder

php - 获取 laravel 5 中所有 Controller 和 Action 的列表

我是laravel的新手,想获取所有Controller的列表和该Controller中的操作列表。只是想知道是否有办法通过代码获取所有Controller及其所有方法的列表?谢谢,打碟机 最佳答案 根据您解释需要了解Controller操作的方式,操作似乎已经映射到路由,这意味着您可以使用路由获取映射Controller和操作的列表。以下代码将生成一组已注册的路由Controller操作:$controllers=[];foreach(Route::getRoutes()->getRoutes()as$route){$action

php - Facebook OAuthException : "user hasn' t authorized the application to perform this action"

使用FacebookPHPSDK,当我尝试发布状态更新时出现以下错误:Fatalerror:UncaughtOAuthException:(#200)Theuserhasn'tauthorizedtheapplicationtoperformthisaction这些是我采取的步骤:获取代码:https://graph.facebook.com/oauth/authorize?client_id=FB_APP_ID&redirect_uri=REDIRECT_URI获取访问token:https://graph.facebook.com/oauth/access_token?client

php - 我可以渲染 View 而不在 zend 框架 2 的 Action Controller 中返回它吗?

现在我这样做:publicfunctionindexAction(){...$view=newViewModel(array('foo'=>'bar',));return$view;}问题是我想在$view渲染之后和布局渲染之前做一些事情:publicfunctionindexAction(){...$view=newViewModel(array('foo'=>'bar',));$layout=$this->layout();$layout->content=$view->render();...//hereIwanttodosomeimportantaction...$html=$