TP5 騰訊雲老版對接簡訊

2021-10-25 08:10:22 字數 1891 閱讀 2921

傳送簡訊的方法

/**

* 傳送簡訊

*/public

function

requiremes

($phone

,$code

)else

}else

}

curl請求方法

/**

* 模擬post與get請求

* @param string $url [請求位址]

* @param string $type [請求方式 post or get]

* @param bool|string|array $data [傳遞的引數]

* @param int $timeout [可選:超時時間]

*/public

function

request

($url

,$type

,$data

=false

,$header=[

],$timeout=0

)// 設定返回內容做變數儲存

curl_setopt

($cl

,curlopt_returntransfer,1

);// 設定需要返回header

curl_setopt

($cl

,curlopt_header

,true);

// 設定請求頭

// 設定請求頭if(

count

($header

)>0)

// 設定需要返回body

curl_setopt

($cl

,curlopt_nobody,0

);// 設定超時時間if(

$timeout

>0)

// post/get引數處理

//在http 請求頭加入 gzip壓縮

//curl返回的結果,採用gzip解壓

//curl_setopt($cl, curlopt_encoding, "gzip");

// 讀取獲取內容

$response

=curl_exec

($cl);

// 讀取狀態

$status

=curl_getinfo

($cl);

// 讀取錯誤號

$errno

=curl_errno

($cl);

// 讀取錯誤詳情

$error

=curl_error

($cl);

// 關閉curl

騰訊雲簡訊對接PHP

一帆風順的來到了php對接,這裡主要composer的使用 1 安裝 可以使用命令列安裝 php r copy composer setup.php php composer setup.phpphp r unlink composer setup.php 詳情參考 這裡列出composer的幾種常...

TP5呼叫阿里雲簡訊介面實現傳送簡訊功能

因為專案中需要用到阿里雲簡訊驗證碼功能,所以就購買了相應的簡訊包進行測試,以下就是完整 use aliyun core config use aliyun core profile defaultprofile use aliyun core defaultacsclient use aliyun ...

tp5 對接學科網api

this redirect url,302 tp5的重定向方法 至此,會跳轉到學科網的登入頁面,進行登入授權。使用者登入完,會返回code至 notifyurl 上,如果未跳轉,也會有相應的錯誤提示 獲取成功示例 不太懂失敗是什麼樣的.url this oauthserverurl oauth2 p...