Using Laravel 4#39;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.
谁能帮我怎么做?
推荐答案
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 类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在框架外使用 Laravel 4 的 Input 类
基础教程推荐
- 如何替换eregi() 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
