问题描述
所以我不太确定该怎么做,我已经尝试了一些方法,下面将列出其中一个,但是我想做的是将通过HTTP请求发送的信息存储在PHP变量中.
So I am not really sure how to go about this I have tried a few things and I will list one below however what I am trying to do is store information sent in a http request in a PHP variable.
这是Chrome Postman发送的我希望发送的请求的视图.注意"pubapi"是标头".
Here is a view from Chrome Postman of me sending the request I want ot send. Note "pubapi" is a "header".
我一直在处理流明请求,如您在此处看到的记录( http://lumen.laravel .com/docs/requests ),并尝试使用以下内容进行显示,但效果不明显.
I have been messing around with Lumen requests as you can see documented here ( http://lumen.laravel.com/docs/requests ) and have tried using the following below to possibly display them but its not working obviously.
echo Request::all();
我将其放在我的控制器中,我已经...
I am putting this in my controller and I have ...
use Illuminate\Http\Request;
在我的控制器中.
那么我怎么说我将要发送的"pubapi"标头存储到控制器中的php变量中?
So how could I say store the header I am sending "pubapi" into a php variable in my controller?
编辑
不确定这是否有帮助,但是查看Laravel框架文档,我会看到 http://laravel.com/api/5.0/Illuminate/Http/Request.html#method_header 尝试这样做会在我的代码中引发相同的错误.因此,例如,我尝试了以下操作并遇到了相同的错误.
Not sure if this will help, however looking at the Laravel frameworks docs I see this http://laravel.com/api/5.0/Illuminate/Http/Request.html#method_header trying this throws the same error in my code. So for example I tried the following and reached the same error.
echo Request::header('pubapi');
推荐答案
尝试将Illuminate\Http\Request
更改为Request
.
- use Illuminate\Http\Request;
+ use Request;
这篇关于Laravel 5/Lumen请求标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!