zoukankan      html  css  js  c++  java
  • thinkphp5--请求对象request

    判断请求类型

    isGet:判断当前请求类型是否是get请求

    isPost:判断当前请求类型是否是get请求

    isAjax:判断当前请求类型是否是Ajax请求

    这三个方法都是根据method方法的返回值进行匹配的:

    public function method($method = false){
    	if (true === $method) {
    		// 获取原始请求类型
    		return $this->server('REQUEST_METHOD') ?: 'GET';
    	} elseif (!$this->method) {
    		//http://www.digpage.com/web_request.html
    		
    		if (isset($_POST[Config::get('var_method')])) {
    			$this->method = strtoupper($_POST[Config::get('var_method')]);
    			$this->{$this->method}($_POST);
    		} elseif (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) {
    			$this->method = strtoupper($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']);
    		} else {
    			$this->method = $this->server('REQUEST_METHOD') ?: 'GET';
    		}
    	}
    	return $this->method;
    }
    
  • 相关阅读:
    Spark Streaming(一)
    ACID
    SparkSQL
    scala样例类
    centos7 防火墙有关命令
    HBase优化
    scp
    HBase与Hive
    HBase与MapReduce交互
    Hadoop安全模式
  • 原文地址:https://www.cnblogs.com/liwuming/p/10317869.html
Copyright © 2011-2022 走看看