在框架之外使用Laravel 4的Input类 [英] Using Laravel 4's Input class outside the framework
本文介绍了在框架之外使用Laravel 4的Input类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我喜欢Laravel 4处理输入的方式,以及如何通过Input :: get()获取值,无论它是通过get,post或其他方式发送的.
I like the way Laravel 4 handles the input, and how you can get the value via Input::get() no matter if its sent by get, post or whatever.
我正在开发一个不使用Laravel作为框架的项目,但是如果我可以使用Input类,那就太好了.
I'm working on a project that does not use Laravel as the framework, but it will be great if i can use the Input class.
有人可以帮我吗?
推荐答案
输入实际上是Request类.您可以使用Composer要求它:
Input is, in fact, the Request class. You can require it using Composer:
composer require "illuminate/http" "4.x"
在项目中需要Composer autoload.php
:
Require Composer autoload.php
in your project:
require 'vendor/autoload.php';
并使用它:
$input = Illuminate\Http\Request::createFromGlobals();
var_dump($input->all());
这篇关于在框架之外使用Laravel 4的Input类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文