【发布时间】:2017-11-27 02:48:48
【问题描述】:
我有一个包含 HTML 标签的 json 响应:
{
"total": 15,
"per_page": 15,
"current_page": 1,
"last_page": 1,
"next_page_url": null,
"prev_page_url": null,
"from": 1,
"to": 15,
"data": [
{
"id": 48,
"title": "Lamb Ribs with mashed potatoes",
"body": "<p>Lamb Ribs with Mashed Potatoes:<br />230 grams of lamb ribs<br />Marinade:( Teaspoon pomegranate molasses, 1 tablespoon lemon juice, 1 teaspoon tomato paste, 1 teaspoon olive oil, salt, black pepper, oregano)<br />Marinate the ribs for at least 2 hours. Heat a non stick grilling skillet and grill the ribs from both sides untill done.<br /><br />Mashed Potatoes:<br />130 grams of peeled potatoes. Boil until cooked and let to cool.<br />Add a tablespoon of milk, salt, garlic powder and black pepper and mash together.<br />Serve immediately.<br /><br />545 calories<br />24.7 g fat<br />29.8 g carb<br />3.1 g fiber<br />48.3 g protein<br />.</p>",
"excerpt": "",
"format": "standard",
"type": "recipe",
注意:上面的json不是完整的,因为它是长响应文件。
上面的json我已经解码了:
$post = json_decode($response);
在视图文件中:
{{$post->body}}
我该如何解决这个问题?
【问题讨论】:
-
试试:
html_entity_decode($post->body) -
@VincentDecaux 我试过但没用 ,,
{{htmlentities($post->body)}} -
@瑞安文森特。我可以使用什么功能来发送原始输出?请提供解决方案
-
@Ryan Vincent 我在 laravel 中使用 Blade 模板
-
我假设您已经找到了答案 - 不管怎样:stackoverflow.com/questions/29253979/…