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 请求方案 ...
随机推荐
- 新版本的node,全局配置
配置环境变量: 1.在你安装node环境目录下 即是node_modules同级目录中. 创建两个文件夹[node_global]及[node_cache] node_cache:缓存目录 node_ ...
- HashMap底层实现及原理
注意:文章的内容基于JDK1.7进行分析.1.8做的改动文章末尾进行讲解. 一.先来熟悉一下我们常用的HashMap: 1.HashSet和HashMap概述 对于HashSst及其子类而 ...
- 《京东到家订单中心 Elasticsearch 演进历程》----阅读
上篇通过阅读文章对京东到家的架构分析有了初步了解,这次对文章(https://mp.weixin.qq.com/s?__biz=MzU1MzE2NzIzMg==&mid=2247486889& ...
- CentOS7 中创建 Django 项目
1. (新建文件夹用于存放项目)进入指定文件夹,创建Django项目 django-admin.py startproject mysite mysite 为项目名称 2. 进入项目文件夹,新建app ...
- ESA2GJK1DH1K升级篇: STM32远程乒乓升级,基于Wi-Fi模块(ESP8266)AT指令TCP透传方式,MQTT通信控制升级(加入数据校验)
前言 这节演示下,上两节写的利用MQTT来控制STM32控制的程序 测试准备工作(默认访问我的服务器,改为自己的服务器,请看后面说明) 一,下载BootLoader程序(请自行下载) 首先BootLo ...
- 正睿暑期培训day1考试
链接 A 理解一下题意,然后玩几组样例就能发现,实际上就是\(k\)个\(i\)等价于\(1\)个\(i-1\).所以就类似于\(k\)进制进行进位,如果最后\(0\)位上不是\(0\),那么就存在划 ...
- Python连载17-排序函数&返回函数的函数
一.高阶函数-排序 1.定义:把一个序列按照给定算法进行排序 2.key:在排序前对每一个元素进行key函数运算,可以理解成按照key函数定义的逻辑进行排序 3.python2和python3相差巨大 ...
- multer 文件后缀名
我的代码是这样写的. var storage = multer.diskStorage({ destination: function (req, file, cb) { cb(null, 'uplo ...
- nginx二级域名反向代理
nginx二级域名反向代理 添加两个开发测试的域名 test.xxx.com :8088 testmobile.xxx.com: 8089 内网地址:127.0.0.1 外网地址:127.0.0.1 ...
- Debug 路漫漫-14:Python: AttributeError: module 'tensorflow' has no attribute 'sub'
在调试 <Neural Factorization Machines for Sparse Predictive Analytics>论文的源码(https://github.com/he ...