草庐IT

Zend_Controller_Router_Route

全部标签

php - 如何在不使用 ZF2.. 中的任何 Controller 对象的情况下访问 module.php 中的 Controller 插件?

我想在module.php中添加错误处理以在flashmessenger中添加所有错误消息并重定向到特定页面(在我的要求中):publicfunctionhandleError(MvcEvent$e){$exception=$e->getParam('exception');$controller=$e->getTarget();//echo$exception->getMessage();exit;if(!$e->getApplication()->getServiceManager()->get('AuthService')->hasIdentity()){$controller-

php - Laravel 后 Controller 方法和 PostController 不工作

我的Laravel博客项目postcontroller的get方法可以工作,但post方法不工作。我重定向Post方法。但是根据我的代码,它应该返回到我的管理页面。我的Controller代码是validate($request,['title'=>'required|max:120|unique:posts','author'=>'required|max:80','body'=>'required']);$post=newPost();$post->title=$request['title'];$post->author=$request['author'];$post->bod

php - Laravel Controller 获取限制数量的项目

在我的Controller中$items=Item::all();我只想得到前6个项目如何更改代码? 最佳答案 使用take()方法:$items=Item::take(6)->get(); 关于php-LaravelController获取限制数量的项目,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/38930388/

php - 在 Laravel 5.1 中找不到 "Class ' app\Http\Controllers\Controller'

我是Laravel的新手,在学习教程时遇到此错误。这是我在“testController.php”中的代码。这是我的“routes.php”。'test','uses'=>'testController@getHome',]);Route::get('about',['as'=>'about','uses'=>'testController@getAbout',]);我收到这个错误:Class'app\Http\Controllers\Controller'notfound我该如何修复这个错误? 最佳答案 让我们一步一步来。1。检查

php - 如何在 Controller laravel 中使用获取对象

我在Controller中有一个函数可以删除类别及其图像文件。但我无法访问路径属性。我收到此错误未定义属性:Illuminate\Database\Eloquent\Collection::$path。它正在返回路径,但我无法使用它。publicfunctionremove($id){//$category=Category::find($id)->delete();$category_image=CategoryImage::where('category_id','=',$id)->get(['path']);echo$category_image->path;//returnba

php - 将数据从 Controller 传递到 Blade View laravel

我正在尝试通过href将参数发送到从事件列表到事件页面的页面。我的路线是Route::get('eventpage','EventController@index')->name('eventpage');我的事件Controller是query('id');$event=DB::table('events')->where('id',$id)->get();$pics=DB::table('pictures')->where('event_id',$id)->get();$n=count($pics);//thenumberofpicturesforaparticulareventr

php - 如何从 symfony Controller 抛出 400 错误请求?

我设置了一个非常简单的Symfony3.3Controllerstub,其主要操作如下所示:/***@Route("/pair-gallery/{id}")*/publicfunctionindexAction(Int$id){$output=[];returnnewJsonResponse($output);}当我给它一个字符串作为url中的参数(而不是整数)时,我目前收到500错误。这并不可怕,但这并不是我想要的。我如何告诉Symfony发回400(“错误请求”)响应代码? 最佳答案 您可以简单地抛出一个自动转换为HTTP400

php - Zend 框架 : How do you set your layout directory in a modular application?

我要实现的目录结构是这样的:application/default/views/layouts/layout.phtmlapplication/default/views/scripts/index/index.phtmlapplication/admin/views/layouts/layout.phtmlapplication/admin/views/scripts/index/index.phtmllibrary/Zendconfig/config.inipublic/index.php(bootstrap)但我不知道如何让Zend在我的每个模块中找到我的layout.phtml

PHP Zend Framework - Zend_Config 和全局状态

我正在评估Zend_Config_Ini与使用简单常量文件相比的优势。例如-define('DB_HOST',localhost);//versus$config=newZend_Config_Ini('/path/to/config.ini','staging');echo$config->database->params->host;//prints"dev.example.com"唯一的问题是$config不是全局可访问的。那么接下来就需要使用Zend_Registry来存储供应用使用,而不必每次都启动。这似乎增加了比需要更多的复杂性……我是不是遗漏了什么或者Zend_Confi

php - Magento 模块 - 覆盖 Controller ,添加模板

我目前正在开发一个Magento扩展,我已经覆盖了一个核心Controller,它工作正常。我现在已经为我的Controller添加了一个新Action。问题是每当我调用该操作时都会生成一个空白页。如果我回显某些内容,它会正确显示。因此,我深入研究了客户模块和Controller的核心。我在那里看到像indexAction()这样的方法以这种方式实现布局:loadLayout();$this->_initLayoutMessages('customer/session');$this->_initLayoutMessages('catalog/session');$this->getL