我一直在使用这个例子错误JSON编码和解码的Oauth API - PHP
http://code.google.com/p/oauth-php/wiki/ConsumerHowTo#OAuth_Consumer
而且在消费者页我传递的PARAMS作为JSON编码字符串创建一个PHP的OAuth API。
$key = '35345345345vertrtertert'; // fill with your public key
$secret = 'h rtyrtyr767567567567'; // fill with your secret key
$url = "www.server.com/serverurl.php";
$options = array('consumer_key' => $key, 'consumer_secret' => $secret);
OAuthStore::instance("2Leg", $options);
$method = "POST";
$params = array(
'radius' => '50',
'latitude'=>'13.35',
'longitude'=>'17.35'
);
$params = json_encode($params);
而在服务器页面(即serverurl.php)正在打印使用
print_r($_REQUEST);
请求和我使用JSON解码解码的字符串,但我得到这个值作为
Array
(
[radius] => 50
[latitude] => 13_35
[longitude] => 17_35
)
.
被_
取代经纬度 如何管理这个
如果一直这样做,只需执行'str_replace()'。这是一个冒险的解决方案,但它会起作用。 – Matt 2012-08-03 14:20:15
但我不认为这是很好的解决方案:) – Warrior 2012-08-03 14:21:12