php - 如何在 PHP 中将 HTML 字符串存储在 JSON 中?

标签 php json redis

我在我的注册表中使用 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>&nbsp;</p><p>&nbsp;</p>"}

enter image description here

最佳答案

你不需要在 json 中这样做,这不是使用 json 的想法。仅传输数据,然后在同一网络中通过 jquery 构建 html

关于php - 如何在 PHP 中将 HTML 字符串存储在 JSON 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30526970/

相关文章:

javascript - 获取div后面的数据

php - 将图像保存在数据库mysql中

c++ - 如何获取 C++ json post 的 json 负载

MySQL产品存储-架构

docker - 如何使用Docker Compose将本地Redis连接到Docker容器

PHP:减去时间

php - 避免在循环期间连续显示空列

java - 使用 Jackson 序列化自定义 map

javascript - 在 React 中,如何检查输入单选是否已定义?

mysql - 可能有 node.js redis 回退?