PHP Class BaiduUtils, thinksns

Author: zhujianting([email protected])
Afficher le fichier Open project: medz/thinksns-4 Class Usage Examples

Protected Properties

Свойство Type Description
$DROP_QUERY_PARAMS List of query parameters that get automatically dropped when rebuilding the current URL.

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
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 )

Method Details

errmsg() public static méthode

Get the gloable error message.
public static errmsg ( ) : string
Résultat string

errno() public static méthode

Get the gloable errno.
public static errno ( ) : integer
Résultat integer

errorLog() public static méthode

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

generateSign() public static méthode

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
Résultat string Signature of the parameters

getCurrentUrl() public static méthode

Get the url of current page.
public static getCurrentUrl ( ) : string
Résultat string

isDebugMode() public static méthode

Whether the debug mode of the Baidu OpenAPI SDK is on or off.
public static isDebugMode ( ) : boolean
Résultat boolean

request() public static méthode

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
Résultat string | false Returns string if success, or false if failed

setDebugMode() public static méthode

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() public static méthode

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

Property Details

$DROP_QUERY_PARAMS protected_oe static_oe property

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