本文整理汇总了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);
}