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 请求方案 ...
随机推荐
- [日常] git版本回退
还没有push到远程的时候,版本回退的测试如下 先克隆一个空的测试仓库,这是我自己在gitlab里创建的空仓库git clone http://192.168.1.114:8090/admintsh/ ...
- Vue生命周期钩子---2
vue生命周期简介 咱们从上图可以很明显的看出现在vue2.0都包括了哪些生命周期的函数了. 生命周期探究 对于执行顺序和什么时候执行,看上面两个图基本有个了解了.下面我们将结合代码去看看钩子函数的执 ...
- [C4] 前馈神经网络(Feedforward Neural Network)
前馈神经网络(Feedforward Neural Network - BP) 常见的前馈神经网络 感知器网络 感知器(又叫感知机)是最简单的前馈网络,它主要用于模式分类,也可用在基于模式分类的学习控 ...
- 第02组Beta版本演示
组长博客 组名:十一个憨比 本组组员: 学号 姓名 分工 贡献比例 181700413 黄智 写Beta冲刺的四次博客,写评审表,写word,统筹规划 9% 131700309 林闽沪 代码实现,答辩 ...
- PS快速去除水印方法
步骤 第一步:打开PS软件,鼠标左键单击左上角"文件"-"打开",选择一张图片 第二步:鼠标左键单击左边的工具栏"矩形选框工具" 第三步:鼠 ...
- ABP AOP 用例
介绍 在本文中,我将向您展示如何创建拦截器来实现AOP技术.我将使用ASP.NET Boilerplate(ABP)作为基础应用程序框架和Castle Windsor作为拦截库.这里描述的大多数技术对 ...
- PostgreSQL CentOS 7 安装配置
https://www.postgresql.org/download/ 选择相应的版本 安装完成后,稍微配置下,否则无法远程访问: cd /var/lib/pgsql/11/data vi post ...
- what is variable?
what is variable? variable:pytorch中的变量,存储tensor,数值会不断变动 在 Torch 中的 Variable 就是一个存放会变化的值的地理位置. 里面的值会不 ...
- BFS(四):搜索状态判重
在采用广度优先算法进行搜索时,一个需要重点注意的是在搜索过程中判重和去重.前面介绍的几个例子中,判重都较简单,如采用vis[]数组,若vis[i]==0,则i未访问过,i入队列:若vis[i]!=0, ...
- Uboot启动流程分析(一)
1.前言 Linux系统的启动需要一个bootloader程序,该bootloader程序会先初始化DDR等外设,然后将Linux内核从flash中拷贝到DDR中,最后启动Linux内核,uboot的 ...