最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

PHP 中TP5 Request 請(qǐng)求對(duì)象的實(shí)例詳解

 更新時(shí)間:2017年07月31日 09:56:20   作者:onestopweb  
這篇文章主要介紹了PHP 中TP5 Request 請(qǐng)求對(duì)象的實(shí)例詳解的相關(guān)資料,這里提供實(shí)現(xiàn)代碼幫助大家理解這部分內(nèi)容,需要的朋友可以參考下

PHP 中TP5 Request 請(qǐng)求對(duì)象

public/index.php

<?php 
 
// [ 應(yīng)用入口文件 ] 
// 定義應(yīng)用目錄 
define('APP_PATH', __DIR__ . '/../app/'); 
 
// 定義配置文件目錄和應(yīng)用目錄同級(jí) 
define('CONF_PATH', __DIR__.'/../config/'); 
 
// 加載框架引導(dǎo)文件 
require __DIR__ . '/../thinkphp/start.php'; 

 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()); 
     
    # 請(qǐng)求類型 
    dump($request->method()); 
    dump($request->isGet()); 
    dump($request->isPost()); 
    dump($request->isAjax()); 
     
    # 請(qǐng)求的參數(shù) 
    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" 
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 請(qǐng)求對(duì)象的實(shí)例如有疑問(wèn)請(qǐng)留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!

相關(guān)文章

最新評(píng)論

顺昌县| 普洱| 淮南市| 桑植县| 林州市| 霍山县| 措勤县| 健康| 乡城县| 乌兰察布市| 南开区| 驻马店市| 石阡县| 安国市| 赤峰市| 虹口区| 陵川县| 木里| 高唐县| 正镶白旗| 敖汉旗| 丘北县| 西峡县| 化德县| 普格县| 建湖县| 积石山| 襄垣县| 巴塘县| 榆树市| 雅江县| 怀宁县| 石景山区| 深水埗区| 天门市| 五常市| 怀集县| 芜湖市| 蕉岭县| 吉隆县| 台安县|