nginx location 指令匹配顺序

官方 http://nginx.org/en/docs/http/ngx_http_core_module.html#location
中文有人这样理解 http://www.php100.com/html/program/nginx/2013/0905/5535.html
还有这个 http://blog.sina.com.cn/s/blog_97688f8e0100zws5.html

下面这个理解的不错,
这个 http://blog.chinaunix.net/uid-25196855-id-108805.html

下面的那个 3 是 上尖号和波浪号

摘录如下

nginx-location

获取远程ip地区

注意,此方法运行缓慢,切不可在大量访问处使用!或者请使用缓存!

感谢 http://snowcoal.com/article/324.html

function ip_info($ip = NULL, $purpose = "location", $deep_detect = TRUE) {
  $output = NULL;
  if (filter_var($ip, FILTER_VALIDATE_IP) === FALSE) {
    $ip = $_SERVER["REMOTE_ADDR"];
    if ($deep_detect) {
      if (filter_var(@$_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP))
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
      if (filter_var(@$_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP))
        $ip = $_SERVER['HTTP_CLIENT_IP'];
    }
  }
  $purpose  = str_replace(array("name", "\n", "\t", " ", "-", "_"), NULL, strtolower(trim($purpose)));
  $support  = array("country", "countrycode", "state", "region", "city", "location", "address");
  $continents = array(
    "AF" => "Africa",
    "AN" => "Antarctica",
    "AS" => "Asia",
    "EU" => "Europe",
    "OC" => "Australia (Oceania)",
    "NA" => "North America",
    "SA" => "South America"
  );
  if (filter_var($ip, FILTER_VALIDATE_IP) && in_array($purpose, $support)) {
    $ipdat = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=" . $ip));
    if (@strlen(trim($ipdat->geoplugin_countryCode)) == 2) {
      switch ($purpose) {
        case "location":
          $output = array(
            "city"      => @$ipdat->geoplugin_city,
            "state"     => @$ipdat->geoplugin_regionName,
            "country"    => @$ipdat->geoplugin_countryName,
            "country_code"  => @$ipdat->geoplugin_countryCode,
            "continent"   => @$continents[strtoupper($ipdat->geoplugin_continentCode)],
            "continent_code" => @$ipdat->geoplugin_continentCode
          );
          break;
        case "address":
          $address = array($ipdat->geoplugin_countryName);
          if (@strlen($ipdat->geoplugin_regionName) >= 1)
            $address[] = $ipdat->geoplugin_regionName;
          if (@strlen($ipdat->geoplugin_city) >= 1)
            $address[] = $ipdat->geoplugin_city;
          $output = implode(", ", array_reverse($address));
          break;
        case "city":
          $output = @$ipdat->geoplugin_city;
          break;
        case "state":
          $output = @$ipdat->geoplugin_regionName;
          break;
        case "region":
          $output = @$ipdat->geoplugin_regionName;
          break;
        case "country":
          $output = @$ipdat->geoplugin_countryName;
          break;
        case "countrycode":
          $output = @$ipdat->geoplugin_countryCode;
          break;
      }
    }
  }
  return $output;
}

shopnc o2o 更换短信接口

修改 api\message\include\Client.php

里面的sendsms函数

function sendSMS($mobiles=array(),$content,$sendTime='',$addSerial='',$charset='GBK',$priority=5,$smsId=8888)
	{
		
		$params = array('arg0'=>$this->serialNumber,'arg1'=>$this->sessionKey,'arg2'=>$sendTime,
			'arg4'=>$content,'arg5'=>$addSerial, 'arg6'=>$charset,'arg7'=>$priority,'arg8'=>$smsId
			);
			
		/**
		 * 多个号码发送的xml内容格式是 
		 * 159xxxxxxxx
		 * 159xxxxxxx2
		 * ....
		 * 所以需要下面的单独处理
		 * 
		 */
		 
		foreach($mobiles as $mobile)
		{
			//array_push($params,new soapval("arg3",false,$mobile));
			 //此处
			 
		}
		//$result = $this->soap->call("sendSMS",$params,$this->namespace);
		
		return $result;
		
	}