【发布时间】:2014-10-22 08:11:41
【问题描述】:
我正在使用 PHP 开发 Android 应用程序的 Web 服务。我正在尝试以 JSON 格式发送带有其他数据的 URL。但是 URL 发送的数据在 URL 中显示了不需要的斜杠 (//)。
这是我正在使用的代码:
if(isset($_POST['category_id'])):
$result=$db->sub_category($_POST['category_id']);
if($result):
$msg="Success";
$arr = array();
while($row=mysql_fetch_array($result)):
$arr['response'][] = array('category' => $row['category'], 'image' => "http://intelmobizsolution.com/Iphone/upload/iphone/".$row['image'], 'msg'=>$msg,'status'=>true);
endwhile;
$abc=json_encode($arr);
echo json_encode($arr);
endif;
endif;
但结果显示如下:
{"response":[{"category":"Administrative Support2","image":"http:\/\/intelmobizsolution.com\/Iphone\/upload\/iphone\/27792582102banner_02.jpg","msg":"Success","status":true}]}
如何以我想要的格式发送带有 JSON 的 URL?
【问题讨论】: