Json在Wordpress中解码 [英] Json decode in wordpress

查看:136
本文介绍了Json在Wordpress中解码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地主机中使用此代码

here I use this code in my local host

$fromdata= $_POST["data"];
$fromValue=json_decode($fromdata);
$patientid=  $fromValue->patientid;
$patientname= $fromValue->name;

它工作正常...如果我使用

its working fine... if i use

print_r($fromdata); 

它打印以下格式

{"patientid":"55","name":"Sow"}

.相同的代码在wordpress中使用print_r($fromdata);返回{\"patientid\":\"16\",\"name\":\"Ravindran\"}此.却无法获得价值

. the same code is used in wordpress the print_r($fromdata); return {\"patientid\":\"16\",\"name\":\"Ravindran\"} this. and unable to get value

如何从此对象中获取价值 谢谢

how to get value from this object thanks

推荐答案

您可以尝试一下.

<?php

$data = '{\"patientid\":\"16\",\"name\":\"Ravindran\"}';

$data = stripslashes($data);

$return = json_decode($data);



print_r($return);

这篇关于Json在Wordpress中解码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆