草庐IT

example_route

全部标签

php - Laravel redirect::route 在页面加载之间显示一条消息

我目前正在使用Laravel开发一个网络应用程序,直到最近该应用程序都运行良好。我不知道是什么触发了它,但这里是我遇到的问题的摘要:登录曾经工作,因为我有一个执行此操作的AccountController:$auth=Auth::attempt(array('username'=>Input::get('username'),'password'=>Input::get('password'),'active'=>1);if($auth){returnRedirect::route('home');}returnRedirect::route('account-sign-in');回家

php - Route.php 中的授权和身份验证 : Laravel 5. 1

我有下面的路由来检查用户是否经过身份验证,然后才让他们访问该页面'auth',],function(){Route::get('/Categories-List','Skills\Category_Controller@index');});在我的auth()->user()中,有RoleID来检查用户是Admin还是其他角色。我想检查RoleID是否为1然后只允许他们访问该页面。我可以在Laravel5.1中设置授权和身份验证吗 最佳答案 好的,所以您需要创建AdminMiddleware并将其添加到路由中。首先,打开您的User

php - 从 Laravel Routes.php 调用 Controller 函数

我在Laravel的Orders_Controller中有一个名为getOrders($user)的函数。它调用原始数据库查询并构建一个JSON数组以返回。我不知道如何从我的路由文件中调用这个函数。基本上我在路由中收到一个POST,插入新订单,然后我想从此路由函数调用getOrders(user)以获取给定用户的所有现有订单。谁能帮我弄清楚如何从Routes.php中调用这个函数?路由.php//HandleaneworderPOSTRoute::post('order',array('do'=>function(){......//HANDLEPOSTDATAANDINSERTNEW

php - Route.php 中的 UnexpectedValueException 行 639 : Invalid route action: [App\Http\Controllers\PortfolioController]

为什么我会收到此错误。我创建了一个PortfolioController。然后我用这个做了一条路线Route::get('portfolio','PortfolioController');所以在我的Controller页面中我做了这个。我在输入localhost/portfolio/paintings时收到此错误 最佳答案 从代码的外观来看,您似乎正在尝试设置implicitcontrollerroute.你很接近,但你的路线定义有点偏离。您需要使用controller而不是get:Route::controller('portf

php - 拉维尔 5 : Fetch ajax data in route and pass to controller

我正在使用Laravel5并希望使用一些数据对Controller进行ajax调用:$.ajax({url:"/getOrgById",data:JSON.stringify({id:1})})routes.php有:Route::get('/getOrgById','HomeController@getOrgById');HomeController.php:publicfunctiongetOrgById($data){//codeherefailswithmessage'Missingargument1forHomeController::getOrgById()}如何将数据从a

php - 为什么 www.example.com/index.php/my/path/here 是由 index.php 处理的?

我只是好奇,apache的功能是如何调用的,它是这样引导请求的www.example.com/index.php/my/path/here到一个文件index.php?一开始,您可能会想,如果此请求导致404错误页面,那将是正确的,因为在站点根目录中没有名为index.php的文件夹。顺便说一句,是否有可能关闭此Apache功能(如果它是一个功能)以便此类请求真正以404结束? 最佳答案 这不是URL重写功能。或者至少它不需要是。参见AcceptPathInfoDirective:Thisdirectivecontrolswheth

php - Symfony2 : Routing priority

在Symfony2中是否有优先级路由?我正在使用它看起来像这样的注释Controller//TestController.php/***@Route("/test")*/classTestControllerextendsController{/***@Route("/a",name="test_a")*/.....//DummyController.php/***@Route("/")*/classDummyControllerextendsController{/***@Route("/{varA}/{varB}",name="dummy_one")*/.....配置//routi

php - '在插件管理器 Zend\Router\RoutePluginManager 中找不到名为 "Example\Segment"的插件

我目前正在学习Zend3教程。唯一的区别是我使用的是示例表/类而不是相册。一切似乎都符合规范,除了我每次尝试访问开发服务器时都会收到以下错误:Fatalerror:Uncaughtexception'Zend\ServiceManager\Exception\ServiceNotFoundException'withmessage'Apluginbythename"Example\Segment"wasnotfoundinthepluginmanagerZend\Router\RoutePluginManager'inC:\Websites\ZEND2\vendor\zendframe

php - parse_url() 在传递 example.com 时返回错误

根据以下代码,如果$host_name类似于example.comPHP返回通知:Message:Undefinedindex:host但在完整的URL,如http://example.comPHP返回example.com。我尝试了带有FALSE和NULL的if语句,但没有成功。$host_name=$this->input->post('host_name');$parse=parse_url($host_name);$parse_url=$parse['host'];如何修改脚本以接受example.com并返回它? 最佳答案

php - "example@something.com"-> "example"PHP

我对正则表达式还很陌生,无法真正弄清楚它是如何工作的。我试过这个:functionchange_email($email){returnpreg_match('/^[\w]$/',$email);}但这只返回bool值true或false,我希望它返回@之前的所有内容。这可能吗?我什至不认为我在这里使用了正确的php函数.. 最佳答案 使用explode尝试更简单的方法:explode('@',$email)[0]; 关于php-"example@something.com"->"exa