草庐IT

control_reg

全部标签

php - Codeigniter 将数据从 Controller 传递到 View

根据here我有以下Controller:classUserextendsCI_Controller{publicfunctionLogin(){//$data->RedirectUrl=$this->input->get_post('ReturnTo');$data=array('title'=>'MyTitle','heading'=>'MyHeading','message'=>'MyMessage');$this->load->view('User_Login',$data);}//More...}在我的User_Login.phpView文件中,我这样做:结果是:APHPEr

php - 如何在 Symfony2 Controller 中获取 Action 名称?

有没有办法在Symfony2Controller中获取Action的名称?publicfunctioncreateAction(Request$request,$title){//Expectedresult:create$name=$this->getActionName();} 最佳答案 使用:$request->attributes->get('_controller');//willgetyourBundle\Controller\yourController::CreateAction$params=explode('::

php - CodeIgniter:将参数传递给 Controller ​​时找不到页面?

我正在尝试将参数传递给codeigniter中的控件,但我收到404页面未找到错误,我不明白,我按照指南说的做了:https://www.codeigniter.com/user_guide/general/controllers.html#passing-uri-segments-to-your-methods当我删除索引函数中的参数并访问Controller时,一切正常,但我无法将值传递给它...这是我尝试发送参数的代码:http://mysite/123如何从codeigniter获取有关此错误的更多信息?谢谢。 最佳答案 网

php - Symfony2 Controller 中未捕获 Swiftmailer 异常

我正在开发一个简单的邮件应用程序,使用Gmail帐户作为主机。它工作起来很有魅力,但是当send()函数抛出异常时问题就出现了。我看到trycatch语句无法处理异常。即使我使用全局异常类,它也不起作用。这个问题也在某处讨论过。例如:CatchswiftmailerexceptioninSymfony2devenvcontroller或https://groups.google.com/forum/#!topic/symfony2/SlEzg_PKwJw但他们没有找到有效的答案。我的Controller功能代码是:publicfunctionajaxRegisterPublisherA

php - 通过 ajax 调用 phalcon php MVC Controller

我正在使用带有phalconPHP和AngularJs的简单应用程序。我正在尝试通过AJAXPOST请求从angularJSController调用我的phalconPHPController。$http.post('/ControllerName/',{params});我明白了404TherequestedURL/ControllerName/wasnotfoundonthisserver我认为我的请求被路由到我的公共(public)文件夹,而我的phpController位于非公共(public)文件夹中。这些是我的.htaccess规则RewriteEngineonRewrit

php - 需要在单个资源 Controller 中使用 Entrust 角色的建议 - Laravel5

我正在开发一个控制面板应用程序,其中我有多个用户角色,例如globaladmin、编辑器等。现在我想将这些角色与单个UserController资源一起使用。例如,globaladmins应该能够执行所有Restful方法,而编辑器只能查看和更新​​用户。我知道entrust带有开箱即用的中间件,非常适合我的需要。但它只适用于路线(在这种情况下,我需要为每个角色单独的Controller)。我的UserController看起来像这样。ClassUserControllerextendsBaseController{$protected$viewfolder;publicfunctio

javascript - XMLHttpRequest 无法加载 Origin null 不允许 Access-Control-Allow-Origin

我有一个包含以下代码的code.html文件。$.ajax({type:"POST",datatype:"JSONP",url:"path",success:function(msg){vare=document.createElement("div");e.id="ads";document.body.appendChild(e);$("#ads").html(msg);}});当我在浏览器中打开code.html文件时,出现错误:**"XMLHttpRequestcannotloadfile://.....OriginnullisnotallowedbyAccess-Control

php - 路由到子文件夹中的 Controller 在 Laravel 4 中不起作用

当我遇到这个问题时,我正在将我的Laravel3应用程序更新到Laravel4...我尝试过的路线:Route::get('backend/login','backend/UserController@login');Route::get('backend/login','backend.UserController@login'); 最佳答案 就在几个小时前,我遇到了类似的问题,我不得不尝试一下才能使其正常工作。路线:Route::group(array('prefix'=>'admin'),function(){Route::r

php - denyAccessUnlessGranted 在 Controller 多重角色

我发现这个Controller方法可以帮助过滤角色名称的访问:$this->denyAccessUnlessGranted('ROLE_EDIT',$item,'Youcannoteditthisitem.');是否可以对多个角色使用相同的方法。我尝试过类似的方法,但它似乎不起作用:$this->denyAccessUnlessGranted(array('ROLE_EDIT','ROLE_WHATEVER'),$item,'Youcannoteditthisitem.'); 最佳答案 研究该方法显示了它是如何工作的protecte

php - 在 Laravel 中找不到类 'App\Http\Controllers\Response' 错误

我在Laravel5中遇到了这个问题:Class'App\Http\Controllers\Response'notfound。我是这方面的新手,所以我需要你们的帮助。我正在尝试从我的表“funcionarios”中获取json响应。我的Controller是:[]];$statusCode=200;$funcionario=\App\funcionario::all()->take(9);foreach($funcionarioas$item){$response['funcionarios'][]=['id_funcionario'=>$item->id_funcionario,'