PHP 中TP5 Request 请求对象
public/index.php
?
1
2
3
4
5
6
7
8
9
10
11
|
<?php
// [ 应用入口文件 ]
// 定义应用目录
define( 'APP_PATH' , __DIR__ . '/../app/' );
// 定义配置文件目录和应用目录同级
define( 'CONF_PATH' , __DIR__. '/../config/' );
// 加载框架引导文件
require __DIR__ . '/../thinkphp/start.php' ;
|
app\\index\\controller\\Index.php
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<?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
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
string(23) "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"
|
以上就是PHP 中TP5 Request 请求对象的实例如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
原文链接:http://onestopweb.iteye.com/blog/2387699
相关文章
猜你喜欢
- 64M VPS建站:怎样选择合适的域名和SSL证书? 2025-06-10
- 64M VPS建站:怎样优化以提高网站加载速度? 2025-06-10
- 64M VPS建站:是否适合初学者操作和管理? 2025-06-10
- ASP.NET自助建站系统中的用户注册和登录功能定制方法 2025-06-10
- ASP.NET自助建站系统的域名绑定与解析教程 2025-06-10
TA的动态
- 2025-07-10 怎样使用阿里云的安全工具进行服务器漏洞扫描和修复?
- 2025-07-10 怎样使用命令行工具优化Linux云服务器的Ping性能?
- 2025-07-10 怎样使用Xshell连接华为云服务器,实现高效远程管理?
- 2025-07-10 怎样利用云服务器D盘搭建稳定、高效的网站托管环境?
- 2025-07-10 怎样使用阿里云的安全组功能来增强服务器防火墙的安全性?
快网idc优惠网
QQ交流群
您的支持,是我们最大的动力!
热门文章
-
2025-06-04 100
-
spring cloud 之 Feign 使用HTTP请求远程服务的实现方法
2025-05-29 13 -
spring boot tomcat jdbc pool的属性绑定
2025-05-29 31 -
2025-05-25 76
-
2025-06-04 77
热门评论