drtzb06222 2019-07-09 11:39
浏览 129
已采纳

使用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 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>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#stm32#的问题:寻找一块开发版,作为智能化割草机的控制模块和树莓派主板相连,要求:最低可控制 3 个电机(两个驱动电机,1 个割草电机),其次可以与树莓派主板相连电机照片如下:
  • ¥15 Mac(标签-IDE|关键词-File) idea
  • ¥15 潜在扩散模型的Unet特征提取
  • ¥15 iscsi服务无法访问,如何解决?
  • ¥15 感应式传感器制作的感应式讯响器
  • ¥15 如何使用SC92F8003固件库解析私有协议数据?
  • ¥15 如何在音频中嵌入字符串(水印)信息进行传递
  • ¥30 plc怎么以设计说明书申请软著
  • ¥15 硬盘识别不了,需要初始化,可我的数据怎么办
  • ¥15 lvm2被mask了,怎么unmask都没用(标签-ubuntu|关键词-apt)