本文整理匯總了PHP中Pw::jsonDecode方法的典型用法代碼示例。如果您正苦於以下問題:PHP Pw::jsonDecode方法的具體用法?PHP Pw::jsonDecode怎麽用?PHP Pw::jsonDecode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pw
的用法示例。
在下文中一共展示了Pw::jsonDecode方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doAvatar
public function doAvatar($uid, $file = '')
{
$time = Pw::getTime();
$query = array('m' => 'api', 'c' => 'avatar', 'a' => 'doavatar', 'windidkey' => WindidUtility::appKey(WINDID_CLIENT_ID, $time, WINDID_CLIENT_KEY, array('uid' => $uid, 'm' => 'api', 'c' => 'avatar', 'a' => 'doavatar'), array()), 'clientid' => WINDID_CLIENT_ID, 'time' => $time, 'uid' => $uid);
$url = WINDID_SERVER_URL . '/index.php?' . http_build_query($query);
$result = WindidUtility::uploadRequest($url, $file);
if ($result === false) {
return WindidError::SERVER_ERROR;
}
return Pw::jsonDecode($result);
}
示例2: open
public static function open($script, $getData = array(), $postData = array(), $method = 'post', $protocol = 'http')
{
$time = Pw::getTime();
list($c, $a) = explode('/', $script);
$query = array('m' => 'api', 'c' => $c, 'a' => $a, 'windidkey' => WindidUtility::appKey(WINDID_CLIENT_ID, $time, WINDID_CLIENT_KEY), 'clientid' => WINDID_CLIENT_ID, 'time' => $time);
$url = WINDID_SERVER_URL . '/index.php?' . http_build_query($query) . '&' . http_build_query($getData);
$result = WindidUtility::buildRequest($url, $postData);
if ($result === false) {
return WindidError::SERVER_ERROR;
}
return Pw::jsonDecode($result);
}
示例3: run
public function run()
{
header("Content-type: text/html; charset=utf-8");
//保證輸出沒有亂碼 √
// $this->uid='1';
// $this->__echoUserinfo();
// var_dump( $_POST);
$accept = file_get_contents("php://input");
// dump($accept);
$isAcceptSuccess = Pw::jsonDecode($accept);
if (isset($isAcceptSuccess['action']) && isset($isAcceptSuccess['data'])) {
// echo "good";
/*填充獲取到的JSON參數*/
$this->acceptAction = $isAcceptSuccess['action'];
$this->acceptData = $isAcceptSuccess['data'];
if (isset($isAcceptSuccess['list'])) {
$this->acceptList = $isAcceptSuccess['list'];
}
if (in_array($this->acceptAction, $this->actionList)) {
if (!$this->acceptData) {
$this->_echoError("acceptData is empty");
exit;
}
/*判斷賬號和密碼是否獲取成功了*/
if (!isset($this->acceptData['username']) || !isset($this->acceptData['passwd'])) {
echo "data is not ok";
exit;
}
if ($this->_check_user_info($this->acceptData['username'], $this->acceptData['passwd'])) {
$this->__formUserData();
// echo $this->acceptAction;
eval('$this->' . $this->acceptAction . '();');
} else {
$this->_echoError("賬號密碼錯誤");
}
// eval('echo "hello";');
} else {
$this->_echoError("action not allow");
exit;
}
} else {
$this->_echoError('json seems like broken');
}
// $this->_echoSuccess();
// $this->_echoError();
// dump($this->acceptArray);
exit;
}
示例4: open
public static function open($script, $getData = array(), $postData = array(), $method = 'post', $protocol = 'http')
{
$time = Pw::getTime();
list($c, $a) = explode('/', $script);
$query = array('m' => 'api', 'c' => $c, 'a' => $a, 'windidkey' => WindidUtility::appKey(WINDID_CLIENT_ID, $time, WINDID_CLIENT_KEY, $getData, $postData), 'clientid' => WINDID_CLIENT_ID, 'time' => $time);
$url = WINDID_SERVER_URL . '/index.php?' . http_build_query($query) . '&' . http_build_query($getData);
//$result = WindidUtility::buildRequest($url, $postData); //係統自帶的函數不知道是什麽問題,先用這個函數,並且加上過濾防範了安全。taishici
if (!(strpos($url, 'http://') === 0 || strpos($url, 'https://') === 0)) {
return false;
}
$result = file_get_contents($url);
if ($result === false) {
return WindidError::SERVER_ERROR;
}
return Pw::jsonDecode($result);
}
示例5: open
public static function open($script, $getData = array(), $postData = array(), $method = 'post', $protocol = 'http')
{
$time = Pw::getTime();
list($c, $a) = explode('/', $script);
$getData['m'] = 'api';
$getData['c'] = $c;
$getData['a'] = $a;
$getData['clientid'] = WINDID_CLIENT_ID;
$getData['time'] = $time;
$getData['windidkey'] = WindidUtility::appKey(WINDID_CLIENT_ID, $time, WINDID_CLIENT_KEY, $getData, $postData);
$url = WINDID_SERVER_URL . '/index.php?' . http_build_query($getData);
if (!(strpos($url, 'http://') === 0 || strpos($url, 'https://') === 0)) {
return false;
}
//$result = file_get_contents($url);
$result = WindidUtility::buildRequest($url, $postData);
if ($result === false) {
return WindidError::SERVER_ERROR;
}
return Pw::jsonDecode($result);
}