我已經構建了一個REST web服務,我想從我的json結果中刪除斜線。我有一些數據存儲在我的數據庫中,其中一個字段包含websitelinks.I可以通過我的正常視圖,這是html和通過我的json視圖來訪問它們。正常回報de鏈接正常,但json廣告斜線如下:如何從我的json結果中刪除斜槓結果CakePHP
http:\/\/mywebsite\/company\/upload\/siteman\/thumbnails\/carr\/
我該如何刪除它?這裏是我的CakePHP代碼:
// De html view
<h2>View all posts</h2>
<table>
<tr>
<th>Title</th>
<th>Body</th>
</tr>
<?php foreach($images as $image):?>
<tr>
<td><?php echo $image['Image']['id'];?></td>
<td><?php echo $image['Image']['plaatjes'];?></td>
</tr>
<?php endforeach; ?>
</table>
// The json view
<?php
echo json_encode($images);
?>
你爲什麼要刪除他們?這是完美的罰款JSON和斜槓將解碼時消失。 – deceze
因爲我需要通過移動應用程序訪問此json。所以json結果中的websitelinks必須可以直接訪問。 – jan
爲什麼移動應用程序會有所作爲?你不是在客戶端解碼JSON嗎? – deceze