drtzb06222
2019-07-09 11:39 阅读 103
已采纳

使用php格式化JSON到wordpress中的html [关闭]

I have an api that returns this

{
    "success": true,
    "data": {
        "medicineId": 15,
        "medicineName": " Alectinib",
        "medicineDescription": "Alectinib is a second generation oral drug that selectively inhibits the activity of anaplastic lymphoma kinase (ALK) tyrosine kinase. It is specifically used in the treatment of non-small cell lung cancer (NSCLC) expressing the ALK-EML4 (echinoderm microtubule-associated protein-like 4) fusion protein that causes proliferation of NSCLC cells. Inhibition of ALK prevents phosphorylation and subsequent downstream activation of STAT3 and AKT resulting in reduced tumour cell viability.

Approved under accelerated approval in 2015, alectinib is indicated for use in patients who have progressed on or were not tolerant of crizotinib, which is associated with the development of resistance.",
        "sideEffects": "tiredness . 
constipation . 
swelling in your hands,feet,ankles,face .
muscle pain , tenderness and weakness (myalgia) .
low red blood cell count (anemia) .",
        "chemicalFormula": "
C30H34N4O2",
        "indication": "Alectinib is a kinase inhibitor indicated for the treatment of patients with anaplastic lymphoma kinase (ALK)-positive, metastatic non-small cell lung cancer (NSCLC) who have progressed on or are intolerant to crizotinib. This indication is approved under accelerated approval based on tumor response rate and duration of response. Continued approval for this indication may be contingent upon verification and description of clinical benefit in confirmatory trials.",
        "associatedCondition": "Refractory, metastatic Non small cell lung cancer",
        "alternatives": [
            {
                "medicineId": 10,
                "medicineName": "Alclometasone"
            }
        ],
        "categories": [
            "BCRP/ABCG2 Inhibitors",
            "Antineoplastic and Immunomodulating Agents",
            " Antineoplastic Agents"
        ]
    },
    "message": "Successfully retrieved"
}

I want to format that to look good in a popup Any idea how i can do that?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    douhui8163 douhui8163 2019-07-09 11:50

    I guess this is what you were looking for:

    <?php
    $contents = 'Your json result here';
    $jsonArray = json_decode($contents,true);
    $medicineId = $jsonArray["medicineId"];
    ?>
    
    <h1> MedicineId: <?php echo $medicineId ?> </h1>
    
    点赞 评论 复制链接分享

相关推荐