【发布时间】:2015-09-30 20:02:54
【问题描述】:
我实际上对这个 json 是如何无效的感到困惑。我有一个来自更大 json 集的 json:
...
"open_until":{
"date":"2015-10-16 00:00:00",
"timezone_type":3,
"timezone":"America\/Edmonton"
},
"ffba_access_code":"1234",
"overview_content":"
Elevator Pitch<\/h4>\r\n
Fedilus Funds gives investors the ability to participate in the growth of the United States un-banked sector by deploying 'automated commerce machines' in high traffic areas. This is a blended investment that distributes monthly principal and interest back to the investor and once the term has ended, a percentage of revenue is distributed continuously. You are purchasing a portfolio of advanced ATM's that offer a wide range of financial services coupled with a strong management team.<\/p>\r\n\r\n
This is a USD investment with monthly distributions remitted in USD.<\/p>",
.....
当我把它通过 json 格式化程序时,我被告知:
"
Elevator Pitch<\/h4>\r\n
Fedilus Funds gives investors the ability to participate in the growth of the United States un-banked sector by deploying 'automated commerce machines' in high traffic areas. This is a blended investment that distributes monthly principal and interest back to the investor and once the term has ended, a percentage of revenue is distributed continuously. You are purchasing a portfolio of advanced ATM's that offer a wide range of financial services coupled with a strong management team.<\/p>\r\n\r\n
This is a USD investment with monthly distributions remitted in USD.<\/p>"
是“无效”的“违规”部分
我从 php.ini 中的数据库中获取此权限。当我将其拉出以使其符合要求时,我应该对这个特定的数据库字段做些什么吗?
【问题讨论】:
-
您是否尝试将
htmlspecialchars用于您的overview_content 文本? -
如果我没记错的话,换行符是无效的……
-
@Andre 所以我从数据库中提取了数据,如何使其有效?
-
通过json_encode。让我反过来问这个问题:为什么要“手动”编码?
-
@Andre:你没记错:json.org/string.gif 换行符是一个控制字符。