-1
我有一个url返回一组数据作为jSON对象,我想解码返回的数据并将其放入PHP中的变量。我不知道该怎么做..如何获取jSON API数据并将其作为变量存储在PHP中
这是该URL的回报作为结果
{
"result" : "ok",
"tuc" : [ {
"meanings" : [ {
"language" : "en",
"text" : "unwilling to work"
}, {
"language" : "en",
"text" : "relaxed or leisurely"
}, {
"language" : "en",
"text" : "eye: squinting because of weak muscles"
}, {
"language" : "en",
"text" : "Unwilling to do work or make an effort."
}, {
"language" : "en",
"text" : "Unwilling to do work or make an effort."
}, {
"language" : "en",
"text" : "Requiring little or no effort."
}, {
"language" : "en",
"text" : "Relaxed or leisurely."
}, {
"language" : "en",
"text" : "(optometry) Of an eye, squinting because of a weakness of the eye muscles."
}, {
"language" : "en",
"text" : "(cattle brands) Turned so that the letter is horizontal instead of vertical."
} ],
"meaningId" : null,
"authors" : [ 60172 ]
} ],
"phrase" : "lazy",
"from" : "en",
"dest" : "en",
"authors" : {
"60172" : {
"U" : "http://www.omegawiki.org/",
"id" : 60172,
"N" : "omegawiki",
"url" : "https://glosbe.com/source/60172"
}
}
}
我预计前5 DATAS作为我的结果对象,
$text1 = "unwilling to work";
$text2 = "relaxed or leisurely";
$text3 = "eye: squinting because of weak muscles"
$text4 = "Unwilling to do work or make an effort."
$text5 = "Unwilling to do work or make an effort."
数据重复不是问题。
那么你有什么尝试?看起来好像你认为你可以在这里发布问题并期望人们为你做这项工作? – Blizz
@ Blizz:首先将api数据存储为变量,并将其用于在我的页面中显示它。示例<? php echo $ text1; ?>,<? php echo $ text2; ?>,<? php echo $ text3; ?> ... –
所以基本上是的:你期待人们为你做你的工作。 – Blizz