zoukankan      html  css  js  c++  java
  • TP5 Request 请求对象【转】

    appindexcontrollerIndex.php

    <?php 
    namespace appindexcontroller; 
    use thinkRequest; 
    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

  • 相关阅读:
    Struts2框架
    读者写者问题
    哲学家就餐问题
    理解中断
    理解处理机调度
    理解死锁
    理解进程
    Linux CentOS 6.7 挂载U盘
    家庭-养老院模型理解IOC和DI
    Bash基础
  • 原文地址:https://www.cnblogs.com/KillBugMe/p/11889898.html
Copyright © 2011-2022 走看看