PHP Класс BaiduUtils, thinksns

Автор: zhujianting([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$DROP_QUERY_PARAMS List of query parameters that get automatically dropped when rebuilding the current URL.

Открытые методы

Метод Описание
errmsg ( ) : string Get the gloable error message.
errno ( ) : integer Get the gloable errno.
errorLog ( $msg ) Prints to the error log if you aren't in command line mode.
generateSign ( array $params, string $secret, string $namespace = 'sign' ) : string Generate the signature for passed parameters.
getCurrentUrl ( ) : string Get the url of current page.
isDebugMode ( ) : boolean Whether the debug mode of the Baidu OpenAPI SDK is on or off.
request ( string $url, array $params = [], string $httpMethod = 'GET', boolean $multi = false ) : string | false Request for a http/https resource
setDebugMode ( boolean $on = true ) Whether to set the debug mode of the Baidu OpenAPI SDK or not.
setError ( integer $errno, string $errmsg ) Set the gloable error number and error message.

Приватные методы

Метод Описание
buildHttpMultipartBody ( array $params ) : string Build the multipart body for file uploaded request.
detectMimeType ( $filename ) : string Tries to detect MIME type of a file
shouldRetainParam ( $param )

Описание методов

errmsg() публичный статический Метод

Get the gloable error message.
public static errmsg ( ) : string
Результат string

errno() публичный статический Метод

Get the gloable errno.
public static errno ( ) : integer
Результат integer

errorLog() публичный статический Метод

Prints to the error log if you aren't in command line mode.
public static errorLog ( $msg )

generateSign() публичный статический Метод

Generate the signature for passed parameters.
public static generateSign ( array $params, string $secret, string $namespace = 'sign' ) : string
$params array Array of parameters to be signatured
$secret string Secret key for signature
$namespace string The parameter which will be excluded when calculate the signature
Результат string Signature of the parameters

getCurrentUrl() публичный статический Метод

Get the url of current page.
public static getCurrentUrl ( ) : string
Результат string

isDebugMode() публичный статический Метод

Whether the debug mode of the Baidu OpenAPI SDK is on or off.
public static isDebugMode ( ) : boolean
Результат boolean

request() публичный статический Метод

Request for a http/https resource
public static request ( string $url, array $params = [], string $httpMethod = 'GET', boolean $multi = false ) : string | false
$url string Url to request
$params array Parameters for the request
$httpMethod string Http method, 'GET' or 'POST'
$multi boolean Whether it's a multipart POST request
Результат string | false Returns string if success, or false if failed

setDebugMode() публичный статический Метод

Whether to set the debug mode of the Baidu OpenAPI SDK or not.
public static setDebugMode ( boolean $on = true )
$on boolean true or false

setError() публичный статический Метод

Set the gloable error number and error message.
public static setError ( integer $errno, string $errmsg )
$errno integer Error code
$errmsg string Error message

Описание свойств

$DROP_QUERY_PARAMS защищенное статическое свойство

List of query parameters that get automatically dropped when rebuilding the current URL.
protected static $DROP_QUERY_PARAMS