我正在使用 Android Studio 使用 volley 发送 GET 请求。我包括一个 HashMAP 参数(称为 whereArray)。我来自凌空请求的 URL 请求看起来像这样......
https://xxxxxxxx.co.za/api/select_from_fact_sighting.php?whereArray={country_name=Botswana, region=Southern Africa}
我需要在服务器端使用此参数的帮助 - 我想在其中循环遍历它并将其内爆到 sql where 子句中。但我正在努力解码我的 php 脚本中的数组(我假设它应该转换为 Json 对象?)。我已经包含了 php 函数的一个片段,我尝试在其中解码数组。
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 中解码参数和遍历结果数组的任何帮助。
谢谢
白板的微信
慕尼黑8549860
随时随地看视频慕课网APP