我有使用json_encode($data, JSON_HEX_QUOT | JSON_HEX_TAG)
如何解碼用JSON_HEX_QUOT編碼的html字符串| JSON_HEX_TAG
&後,其通過PHP json_encode
使用JSON恆定
編碼HTML之前json_encode
/json_decode
{"agent_designation":"Agent","agent_desc":"\u003Cp\u003EAhmed Khan is a commercial consultant, a B.School MBA with flair of consulting businesses. With insightful perception of end user concerns to methodical compliance in consulting Investor groups, his analytical perspective & proactive approach gave significant recognition. His transparency of information and numbers has gained him virtual clients internationally. He has an unchallenging advantage, in consulting business expansion clients conveying value from concept to completion. His consultation justifies a propertyu2019s relevance, while offering holistic solutions from cost to return on investments.\u003C\/p\u003E","agent_img":"\/wp-content\/uploads\/2015\/09\/Ahmed-Khan-31.jpg","agent_linkedin":"","agent_phone":""}
$data
包括下面的HTML,它可以是HTML單用雙引號括起來或者有時候只是簡單的文字。
<p>Ahmed Khan is a commercial consultant, a B.School MBA with flair of consulting businesses. With insightful perception of end user concerns to methodical compliance in consulting Investor groups, his analytical perspective & proactive approach gave significant recognition. His transparency of information and numbers has gained him virtual clients internationally. He has an unchallenging advantage, in consulting business expansion clients conveying value from concept to completion. His consultation justifies a propertyu2019s relevance, while offering holistic solutions from cost to return on investments.</p>
問題出現在當渲染該編碼的HTML它顯示 (
u003Cpu003E
)這些類型的字符。
渲染與json_decode
$agent_info = @json_decode($data);
echo '<pre>';print_r($agent_info);echo '</pre>';
輸出
u003Cpu003EAhmed Khan is a commercial consultant, a B.School MBA with flair of consulting businesses. With insightful perception of end user concerns to methodical compliance in consulting Investor groups, his analytical perspective & proactive approach gave significant recognition. His transparency of information and numbers has gained him virtual clients internationally. He has an unchallenging advantage, in consulting business expansion clients conveying value from concept to completion. His consultation justifies a propertyu2019s relevance, while offering holistic solutions from cost to return on investments.u003C/pu003E
向我們展示一個具體的JSON示例**,緊接在**'json_encode'和**之前**'json_decode'之前。 – deceze
無法重現任何問題:https://3v4l.org/Q5NKL。 – deceze
我的直覺反應是你在某個階段虐待反斜槓,並從'\ u003C'中移除''''''''。很顯然,我看不到在哪裏或如何發生...... – deceze