【发布时间】:2020-01-04 11:06:39
【问题描述】:
我正在使用 Android Studio 使用 volley 发送 GET 请求。我包括一个 HashMAP 参数(称为 whereArray)。我的 volley 请求中的 URL 请求如下所示...
https://xxxxxxxx.co.za/api/select_from_fact_sighting.php?whereArray={country_name=Botswana, region=Southern Africa}
我需要在服务器端使用此参数的帮助 - 我想循环通过它并将其内爆到 sql where 子句中。但我正在努力解码我的 php 脚本中的数组(我假设它应该转换为 Json 对象?)。我在 php 函数中包含了一个 sn-p,我尝试在其中解码数组。
public function select_from_fact_sighting($whereArray) {
$jsonArray = json_decode($whereArray);
$elementCount = count($jsonArray); ```
$whereArray 中的值为{country_name=Botswana, region=Southern Africa}
但是 $jsonArray 中的值为空并且 $elementCount 为 0 意味着 json 解码数组中没有任何内容。非常感谢在 PHP 中解码参数和遍历结果数组的任何帮助。
谢谢
【问题讨论】:
-
凌空没有被弃用吗?
标签: php json android-volley jsondecoder