小编Tec*_*ter的帖子

使用 Php 访问变量的 Json 值,中间用冒号 (:)

我需要访问 Json 中变量元素的值,但问题是变量有一个冒号 (:),而且我每次都得到未定义的变量。

\n\n
{#370 \xe2\x96\xbc\n  +"im:name": {#371 \xe2\x96\xb6}\n  +"im:image": array:3 [\xe2\x96\xb6]\n  +"im:itemCount": {#380 \xe2\x96\xb6}\n  +"im:price": {#381 \xe2\x96\xb6}\n  +"im:contentType": {#385 \xe2\x96\xb6}\n  +"rights": {#387 \xe2\x96\xb6}\n  +"title": {#388 \xe2\x96\xb6}\n  +"link": {#390 \xe2\x96\xb6}\n  +"id": {#391 \xe2\x96\xb6}\n  +"im:artist": {#393 \xe2\x96\xb6}\n  +"category": {#396 \xe2\x96\xb6}\n  +"im:releaseDate": {#397 \xe2\x96\xb6}\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

例如$feed->category可以,\n但是任何中间有 : 的东西就像$feed->im:category都会抛出错误。

\n

php variables json

3
推荐指数
1
解决办法
778
查看次数

标签 统计

json ×1

php ×1

variables ×1