我在我的注册表中使用 tinyMCE 编辑器。我在编辑器中打印表格并提交表格。我将这些数据以 json 格式存储在 Redis 中。但是当我获取 json 并对其进行解码时,由于 html,json 未正确解码string.So I have did google and find to solution to addslashes near quatition.I did that also now problem is for whitespaces.If I remove whitespaces and decode it.it is decoded correctly.I want to know proper solution of it.
这是我有问题的 json 字符串
{"Body":"<table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width:500px\"><tbody><tr> <td>{-REMITTANCE_BATCH-}</td> <td>Remittance Batch</td></tr><tr> <td>{-REMITTANCE_BATCH-}</td> <td>Remittance Batch</td></tr><tr> <td>{-REMITTANCE_BATCH-}</td> <td>Remittance Batch</td></tr></tbody></table><p> </p><p> </p>"}
最佳答案
你不需要在 json 中这样做,这不是使用 json 的想法。仅传输数据,然后在同一网络中通过 jquery 构建 html
关于php - 如何在 PHP 中将 HTML 字符串存储在 JSON 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30526970/