2017-11-25 71 views
0

我有包含HTML标签体的JSON响应:试图包含HTML标签的JSON数据加载到HTML文件

{ 
    "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, &nbsp;oregano)<br />Marinate the ribs for at least 2 hours. &nbsp;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}} 

文本加载,但它不是格式化为带应该标记。 enter image description here

在查看源/铬它出现这样的: - enter image description here

我怎么能解决这个问题?

+0

尝试:'html_entity_decode($后>体)' –

+0

@VincentDecaux我试过,但没有奏效,,​​{{ヶ辆($后>体)}} – user2873860

+0

@瑞文文森特。我可以使用什么功能来发送原始输出?请提供解决方案 – user2873860

回答