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 请求方案 ...
随机推荐
- [日常] lscpu查看cpu的详细信息
查看自己电脑的cpu的详细信息 root@tao-PC:/home/tao# lscpu Architecture: x86_64 CPU op-mode(s): -bit, -bit Byte Or ...
- Docker Harbor
简介: Harbor是一个用于存储Docker镜像的企业级Registry服务:本章将介绍如何搭建Harbor Registry! Github官方安装文档: https://github.com/g ...
- 使用ML.NET进行自定义机器学习
ML.NET是Microsoft最近发布的用于机器学习的开源,跨平台,代码优先的框架.尽管对我们来说是一个新的框架,但该框架的根源是Microsoft Research,并且在过去十年中已被许多内部团 ...
- 03webpack--输入webpack--自动打包
如何实现时时跟新我写的代码 此时就需要有一个配置文件了 webpack.config.js这个文件 这个文件是在跟目录下哦 webpack是基于node去构建的 所以你的依法和node还是很相似的哦 ...
- python3.5.3rc1学习三:文件操作
##全局变量与局部变量x = 6 def printFuc(): y = 8 z =9 print(y + z) print(x) printFuc()#print(y)#常见错误##name = & ...
- OpenGL ES 入门
写在前面 记录一下 OpenGL ES Android 开发的入门教程.逻辑性可能不那么强,想到哪写到哪.也可能自己的一些理解有误. 参考资料: LearnOpenGL CN Android官方文档 ...
- springboot2.0 management.security.enabled无效
在1.5.x版本中通过management.security.enabled=false来暴露所有端点 在使用springcloud的时候,如果基于springboot2的版本的配置中心,无法使用SV ...
- 如何在 C# 中自定义 Comparer,以实现按中文拼音(a-z)来排序
1. 为何要自定义 Comparer a. 先看如下代码 class Program { public static void Main(string[] args) { List<string ...
- 【UOJ#62】【UR #5】怎样跑得更快(莫比乌斯反演)
[UOJ#62][UR #5]怎样跑得更快(莫比乌斯反演) 题面 UOJ 题解 众所周知,\(lcm(i,j)=\frac{ij}{gcd(i,j)}\),于是原式就变成了: \[\sum_{j=1} ...
- 【07】Nginx:状态统计 / 状态码统计
写在前面的话 在 nginx 中,有些时候我们希望能够知道目前到底有多少个客户端连接到了我们的网站.我们希望有这样一个页面来专门统计显示这些情况.这个需求在 nginx 中是可以实现的,我们可以通过简 ...