当我对数据进行编码时,它会添加意外的斜杠。
这是数据
""\"\\\"[{\\\\\\\"PropertyId\\\\\\\":\\\\\\\"544068\\\\\\\",\\\\\\\"FloorplanId\\\\\\\":\\\\\\\"2175341\\\\\\\",\\\\\\\"FloorplanName\\\\\\\":\\\\\\\"50 Regent 1AP\\\\\\\",\\\\\\\"Beds\\\\\\\":\\\\\\\"1\\\\\\\",\\\\\\\"Baths\\\\\\\":\\\\\\\"1.00\\\\\\\",\\\\\\\"MinimumSQFT\\\\\\\":\\\\\\\"667\\\\\\\",\\\\\\\"MaximumSQFT\\\\\\\":\\\\\\\"667\\\\\\\",\\\\\\\"MinimumRent\\\\\\\":\\\\\\\"2475\\\\\\\",\\\\\\\"MaximumRent\\\\\\\":\\\\\\\"2475\\\\\\\",\\\\\\\"MinimumDeposit\\\\\\\":\\\\\\\"0\\\\\\\",\\\\\\\"MaximumDeposit\\\\\\\":\\\\\\\"0\\\\\\\",\\\\\\\"AvailableUnitsCount\\\\\\\":\\\\\\\"1\\\\\\\",\\\\\\\"AvailabilityURL\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"FloorplanImageURL\\\\\\\":\\\\\\\"http:\\\\\\\\\\\\\\\/\\\\\\\\\\\\\\\/cdn.rentcafe.com\\\\\\\\\\\\\\\/dmslivecafe\\\\\\\\\\\\\\\/3\\\\\\\\\\\\\\\/544068\\\\\\\\\\\\\\\/50Reg1AP.jpg\\\\\\\",\\\\\\\"FloorplanImageName\\\\\\\":\\\\\\\"50Reg1AP.jpg\\\\\\\",\\\\\\\"PropertyShowsSpecials\\\\\\\":\\\\\\\"0\\\\\\\",\\\\\\\"FloorplanHasSpecials\\\\\\\":\\\\\\\"0\\\\\\\",\\\\\\\"UnitTypeMapping\\\\\\\":\\\\\\\"0050r1ap\\\\\\\"}]\\\"\"""
答案 0 :(得分:-1)
尝试
json_encode($data, JSON_UNESCAPED_SLASHES);
答案 1 :(得分:-1)
试试这个
<?php
function removeslashes($string)
{
$string=implode("",explode("\\",$string));
return stripslashes(trim($string));
}
/* Example */
$text="""\"\\\"[{\\\\\\\"PropertyId\\\\\\\":\\\\\\\"544068\\\\\\\",\\\\\\\"FloorplanId\\\\\\\":\\\\\\\"2175341\\\\\\\",\\\\\\\"FloorplanName\\\\\\\":\\\\\\\"50 Regent 1AP\\\\\\\",\\\\\\\"Beds\\\\\\\":\\\\\\\"1\\\\\\\",\\\\\\\"Baths\\\\\\\":\\\\\\\"1.00\\\\\\\",\\\\\\\"MinimumSQFT\\\\\\\":\\\\\\\"667\\\\\\\",\\\\\\\"MaximumSQFT\\\\\\\":\\\\\\\"667\\\\\\\",\\\\\\\"MinimumRent\\\\\\\":\\\\\\\"2475\\\\\\\",\\\\\\\"MaximumRent\\\\\\\":\\\\\\\"2475\\\\\\\",\\\\\\\"MinimumDeposit\\\\\\\":\\\\\\\"0\\\\\\\",\\\\\\\"MaximumDeposit\\\\\\\":\\\\\\\"0\\\\\\\",\\\\\\\"AvailableUnitsCount\\\\\\\":\\\\\\\"1\\\\\\\",\\\\\\\"AvailabilityURL\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"FloorplanImageURL\\\\\\\":\\\\\\\"http:\\\\\\\\\\\\\\\/\\\\\\\\\\\\\\\/cdn.rentcafe.com\\\\\\\\\\\\\\\/dmslivecafe\\\\\\\\\\\\\\\/3\\\\\\\\\\\\\\\/544068\\\\\\\\\\\\\\\/50Reg1AP.jpg\\\\\\\",\\\\\\\"FloorplanImageName\\\\\\\":\\\\\\\"50Reg1AP.jpg\\\\\\\",\\\\\\\"PropertyShowsSpecials\\\\\\\":\\\\\\\"0\\\\\\\",\\\\\\\"FloorplanHasSpecials\\\\\\\":\\\\\\\"0\\\\\\\",\\\\\\\"UnitTypeMapping\\\\\\\":\\\\\\\"0050r1ap\\\\\\\"}]\\\"\"""";
echo removeslashes($text);
?>