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 请求方案 ...
随机推荐
- 面向对象程序设计(JAVA) 第11周学习指导及要求
2019面向对象程序设计(Java)第11周学习指导及要求 (2019.11.8-2018.11.11) 学习目标 理解泛型概念: 掌握泛型类的定义与使用: 掌握泛型方法的声明与使用: 掌握泛型接 ...
- pyquery解析库
这一篇整理一下pyquery这个解析库.还是菜,若有错误的地方,欢迎大家随时指正.......(come on.......) pyquery:是一个css选择器,再使用时,也需要传入HTML文本来初 ...
- Pwnable-collision
一样的连接ssh,输入密码,查看文件 看看col.c的源码 #include <stdio.h> #include <string.h> unsigned long hashc ...
- session:
内容回顾: 多对多 class Pulisher(models.Model): name = models.CharField(max_length=32) class Book(models ...
- C语言中关于输出n个数后就换行的问题。
例如:n=10 ........; n++; if(n%10==0&&n!=0) //因为当n=0时,n%10的值也是0,就也会转行,为了防止这种情况的发生,就用了&&a ...
- Loj #2554. 「CTSC2018」青蕈领主
Loj #2554. 「CTSC2018」青蕈领主 题目描述 "也许,我的生命也已经如同风中残烛了吧."小绿如是说. 小绿同学因为微积分这门课,对"连续"这一概 ...
- 有状态 Vs 无状态
NET Core 分布式框架 公司物联网项目集成Orleans以支持高并发的分布式业务,对于Orleans也是第一次接触,本文就分享下个人对Orleans的理解. 这里先抛出自己的观点:Orleans ...
- 扩展centos7.4虚拟机磁盘大小
虚拟机分配磁盘40GB,实际系统分区只用了20GB,需要手工扩展到40GB,操作方法如下: 查看磁盘信息(确认主分区只有17GB):[root@test-web1 ~]# df -hFilesyste ...
- Go命令行—compile
常用作编译命令行指定的单个go源码包.会生成一个以文件.o为后缀的目标文件,其文件名与包内第一个源文件的文件名相同. 目标文件可以与其他对象组合成一个包档案或直接传递给链接器(go tool link ...
- python小项目(python实现鉴黄)源码
import sys import os import _io from collections import namedtuple from PIL import Image class Nude( ...