TP5 Request 请求对象【转】
app\index\controller\Index.php
<?php
namespace app\index\controller;
use think\Request;
class Index
{
public function index(Request $request)
{
# 获取浏览器输入框的值
dump($request->domain());
dump($request->pathinfo());
dump($request->path());
# 请求类型
dump($request->method());
dump($request->isGet());
dump($request->isPost());
dump($request->isAjax());
# 请求的参数
dump($request->get());
dump($request->param());
dump($request->post());
//session('name', 'onestopweb');
//cookie('email', 'onestopweb@163.com');
//session(null);
//cookie('email',null);
dump($request->session());
dump($request->cookie());
dump($request->param('type'));
dump($request->cookie('email'));
# 获取模块 控制器 操作
dump($request->module());
dump($request->controller());
dump($request->action());
# 获取URL
dump($request->url());
dump($request->baseUrl());
}
}
地址栏输入的链接:http://192.168.0.180:55/index/index/index.html?name=chaoyi&type=blog
`string(23)` `"[http://192.168.0.180:55](http://192.168.0.180:55/)"`
`string(22)` `"index/index/index.html"`
`string(17)` `"index/index/index"`
`string(3)` `"GET"`
`bool(true)`
`bool(false)`
`bool(false)`
`array``(2) {`
`[``"name"``] => string(6)` `"chaoyi"`
`[``"type"``] => string(4)` `"blog"`
`}`
`array``(2) {`
`[``"name"``] => string(6)` `"chaoyi"`
`[``"type"``] => string(4)` `"blog"`
`}`
`array``(0) {`
`}`
`array``(1) {`
`[``"name"``] => string(10)` `"onestopweb"`
`}`
`array``(3) {`
`[``"username"``] => string(6)` `"chaoyi"`
`[``"PHPSESSID"``] => string(26)` `"nugcsr2j9krr2lhk8bntggl412"`
`[``"email"``] => string(18)` `"onestopweb@163.com"`
`}`
`string(4)` `"blog"`
`string(18)` `"onestopweb@163.com"`
`string(5)` `"index"`
`string(5)` `"Index"`
`string(5)` `"index"`
`string(45)` `"/index/index/index.html?name=chaoyi&type=blog"`
`string(23)` `"/index/index/index.html"`
原文链接:https://www.iteye.com/blog/onestopweb-2387699
TP5 Request 请求对象【转】的更多相关文章
- Servlet的学习之Request请求对象(3)
本篇接上一篇,将Servlet中的HttpServletRequest对象获取RequestDispatcher对象后能进行的[转发]forward功能和[包含]include功能介绍完. 首先来看R ...
- Servlet的学习之Request请求对象(2)
在上一篇<Servlet的学习(十)>中介绍了HttpServletRequest请求对象的一些常用方法,而从这篇起开始介绍和学习HttpServletRequest的常用功能. 使用Ht ...
- JSP内置九个对象Request请求对象
jsp内置对象是什么呢? 例如Java语言使用一个对象之前需要实例化(也就是所说的new一个对象),创建对象这个过程有点麻烦,所以在jsp中提供了一些内置对象,用来实现很多jsp应用.在使用内置对象时 ...
- opa gatekeeper笔记:AdmissionReview input.request请求对象结构
官方:https://v1-17.docs.kubernetes.io/zh/docs/reference/access-authn-authz/extensible-admission-contro ...
- request请求对象实例
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DemoRequest.as ...
- Servlet的学习之Request请求对象(1)
在本篇中开始对Servlet中的HttpServletRequest请求对象进行学习,请求对象同响应对象一样,我们可以根据该对象中的方法获取例如请求行,请求头和请求实体数据的方法. 在本篇中先对Htt ...
- FastAPI(54)- 详解 Request 请求对象
背景 前面讲了可以自定义 Response,那么这里就讲下请求对象 Request 可以通过 Request 来获取一些数据 获取请求基础信息 @app.get("/base") ...
- TP5.1:request请求对象(使用四种方式获取)
准备: 在index/controller下创建一个名为requests.php的文件(注意:不要起名为request,因为它是关键字,不被允许起名) 动态方法和静态方法的区别: 静态方法:publi ...
- django 获取request请求对象及response响应对象中的各种属性值
django request对象和HttpResponse对象 HttpRequest对象(除非特殊说明,所有属性都是只读,session属性是个例外) HttpRequest.scheme 请求方案 ...
随机推荐
- 挂载system.img并提取文件
今天提取线刷包的system.img出来,使用Mount命令挂载 $ sudo mount -t ext4 -o loop system.img /mnt mount: 文件系统类型错误.选项错误./ ...
- Verilog语言框架
一.常用关键字
- python语法区别
python语法区别: 大小写敏感 (动态语言:python)变量不用声明 p.s: 静态语言(Java)必须声明变量 语句末尾可以不打分号 可以直接进行数学计算 复制.粘贴功能失效,粘贴到别的地方的 ...
- nginx目录详解
- 理解docker镜像
镜像是用来启动容器的只读模板,是容器启动所需要的rootfs,类似于虚拟机所使用的镜像. 列出本机镜像 [root@localhost ~]# docker imagesREPOSITORY TAG ...
- web-never give up
打开题目连接 ?id=1 ,疑是注入点 但是输入其他数字无果 打开源码,发现注释有网页链接 打开连接123.206.87.240:8006/test/1p.html 发现回到了bugku的论坛首页,应 ...
- 自己整理的模拟爬虫的user-agent
自己经常用的一些爬虫用的user-agent头部 This XML file does not appear to have any style information associated with ...
- Ant风格路径表达式
ANT通配符有三种: ? 匹配任何单字符 * 匹配0或者任意数量的字符 ** 匹配0或者更多的目录 举例: /project/*.a 匹配项目根路径下所有在project路径下的.a文件 /proje ...
- 有缓存区的管道channel
package main import ( "fmt" "time" ) func main() { //创建一个有缓存区的管道 ch := make(chan ...
- rss订阅
其实,本质上和爬虫没区别,只不过这是人家主动给你数据,而且是编排好格式后的数据 按个人主页url更新内容 去重,按照redis去重的方式 按时间保存内容 mysql 保存为时间格式(可以根据时间比较大 ...