在框架外使用 Laravel 4 的 Input 类 [英] Using Laravel 4's Input class outside the framework

查看:29
本文介绍了在框架外使用 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.

谁能帮我怎么做?

推荐答案

Input其实就是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 = IlluminateHttpRequest::createFromGlobals();
var_dump($input->all());

这篇关于在框架外使用 Laravel 4 的 Input 类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆