Home  >  Article  >  Backend Development  >  The request object of TP5 Request in PHP

The request object of TP5 Request in PHP

不言
不言Original
2018-06-08 15:44:081922browse

This article mainly introduces relevant information about the detailed explanation of the TP5 Request request object instance in PHP. The implementation code is provided here to help you understand this part of the content. Friends in need can refer to

PHP TP5 Request request object

public/index.php

##

app\index\ controller\Index.php


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()); 
  } 
}

Link entered in the address bar: http://192.168.0.180:55/index/index/index.html ?name=chaoyi&type=blog


##
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"

The above is the entire content of this article. I hope it will be helpful to everyone’s study. Please pay attention to more related content. PHP Chinese website!

Related recommendations:

PHP’s image recognition technology principles and implementation

About thinkPHP’s built-in string interception function


The above is the detailed content of The request object of TP5 Request in PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn