草庐IT

remote-control

全部标签

php - slim 的框架 : routes and controllers

最初,我的SlimFramework应用程序具有经典结构(索引.php)get('/hello/:name',function($name){echo"Hello,$name";});$app->run();但是随着我添加更多的路由和路由组,我转向了基于Controller的方法:索引.phpget('/hello/:name','HelloController::hello');$app->run();HelloController.php这很有效,它有助于组织我的应用程序结构,同时让我可以为每个Controller方法构建单元测试。但是,我不确定这是正确的方法。我觉得我是在自成一格

php - Slim Framework 和 Ember.js 中的 Access-Control-Origin

在阅读了许多问题/答案后,我决定发布。我想SlimFramework-jQuery$.ajaxrequest-MethodDELETEisnotallowedbyAccess-Control-Allow-Methods总结了我发现和尝试过的大部分信息。我正在使用MAMP和PHP5.6进行开发,但生产环境很可能是共享主机。我也在使用ember.js当ember执行POST请求时,我收到Access-Cross-Origin消息:XMLHttpRequestcannotloadhttp://foo.bar/.No'Access-Control-Allow-Origin'headerispr

php - Laravel 5 - Controller 中的路由和可变参数

我想在搜索时生成这样的SEO友好URL:http://www.example.com/search(无过滤器)http://**www.example.com/search/region-filterhttp://**www.example.com/search/region-filter/city-filter并以这种方式对它们进行分页:http://www.example.com/search/2(无过滤器,第2页)http://**www.example.com/search/region-filter/2http://**www.example.com/search/regio

php - codeigniter - 升级 php 和 apache 后未找到 fatal error 类 'CI_Controller'

我在升级Apache从2.2.19.0到2.4.16.0和php从5.3.7.0到5.6.12.0现在我得到这个错误:Fatalerror:Class'CI_Controller'notfoundinsystem\core\CodeIgniter.phponline234CodeIgniter.php第221-235行//LoadthebasecontrollerclassrequireBASEPATH.'core/Controller.php';/***ReferencetotheCI_Controllermethod.**ReturnscurrentCIinstanceobject

php - 将数据从 View 传递到 Controller (codeigniter)

我正在尝试使用从View到Controller的链接传递一些数据。Controller:publicfunctiondetails(){echo$this->input->post('data_id');$data['details']=$this->wapi_db->details($this->input->post('data_id'));$data['latest_news']=$this->wapi_db->latest_news();$data['main_content']="category/details";$this->load->view('includes/te

php - 不完全确定( Controller )转发在 Symfony 中是如何工作的

我尝试将一些带有as功能的代码移动到我的页面,添加到现在看起来像这样的某个Controller:1)?($page*$recordsPerPage)-$recordsPerPage:0;//Query//Records://$movies=$this->getDoctrine()->getEntityManager()->getRepository('AppBundle:Movie')->FindAll();$repository=$this->getDoctrine()->getRepository('AppBundle:Movie');//Datatocount:$qb=$repo

php - 文件夹内的文件夹内的 Controller 不起作用(Codeigniter)

我使用codeigniter一直做得很好,但现在我遇到了一些小问题。我不想将所有内容都放在一个Controller文件中,而是想将它重新分发到一个子文件夹中的许多文件中。例如:localhost/folderA/folderB/controllerFile通过这种方式,文件夹B替换了Controller的主文件,并且所有文件都可以分散到这个新文件夹中,因为不需要在一个文件中包含10个不同的Controller功能(这会使它变大)。在route我添加了一条新线$route['folderA/folderB/(:any)/']='folderA/folderB';我什至认为没有必要添加路由

php - 为什么 Laravel REST Controller $request->input 为 NULL?

我正在学习教程http://www.tutorials.kode-blog.com/laravel-5-angularjs-tutorial我已经设法为我的Controller编写了类似的方法:publicfunctionupdate(Request$request,$id){$employee=Employee::find($id);$employee->name=$request->input('name');//...$employee->save();return"Sucessupdatinguser#".$employee->id;}在教程中认为此代码有效,但实际上var_d

php - 如何将 php 变量从 View (html)发送到 Controller

这是我的html代码。我想将“$category_edit->c_name”值传递给我的Update()Controller。我从另一个Controller获取“$category_edit”变量。我正在使用CodeIgniter框架。">ParentCategory:id.'">';echo$category_edit->p_name;echo'';?>Categoryc_name;?>"id="category_name"value="c_name;?>">Update这是我的update()Controller。我收到错误:undefinedvariable:category_e

php - 在 Controller 中找不到接口(interface) 'Silex\ControllerProviderInterface'

执行api.php时:Fatalerror:Interface'Silex\ControllerProviderInterface'notfoundinC:\xampp\htdocs\lab\src\Api\UserController.phponline9Composer:{"require":{"silex/silex":"^2.0"},"autoload":{"psr-4":{"Api\\":"src/Api"}}}api.php:mount('/',newApi\UserController());$app->run();src/Api/UserController.php:g