找回密碼
 註冊
搜索
查看: 2606|回復: 0

[教學] OpenCart之手機註冊時手機短信獲取驗證碼相關函數

  [複製鏈接]
發表於 2014-12-22 15:21:14 | 顯示全部樓層 |閱讀模式
 
Push to Facebook
  1.    public function Post($curlPost,$url){
  2.       $curl = curl_init();
  3.       curl_setopt($curl, CURLOPT_URL, $url);
  4.       curl_setopt($curl, CURLOPT_HEADER, false);
  5.       curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  6.       curl_setopt($curl, CURLOPT_NOBODY, true);
  7.       curl_setopt($curl, CURLOPT_POST, true);
  8.       curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
  9.       $return_str = curl_exec($curl);
  10.       curl_close($curl);
  11.       return $return_str;
  12.    }
  13.    
  14.    public function xml_to_array($xml){
  15.       $reg = "/<(\w+)[^>]*>([\\x00-\\xFF]*)<\\/\\1>/";
  16.       if(preg_match_all($reg, $xml, $matches)){
  17.          $count = count($matches[0]);
  18.          for($i = 0; $i < $count; $i++){
  19.          $subxml= $matches[2][$i];
  20.          $key = $matches[1][$i];
  21.             if(preg_match( $reg, $subxml )){
  22.                $arr[$key] = $this->xml_to_array( $subxml );
  23.             }else{
  24.                $arr[$key] = $subxml;
  25.             }
  26.          }
  27.       }
  28.       return $arr;
  29.    }
複製代碼


 
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

Archiver|手機版|小黑屋|TShopping

GMT+8, 2025-5-1 02:39 , Processed in 0.024248 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回復 返回頂部 返回列表