gpt4 book ai didi

php - JSON 对象作为 php 字符串

转载 作者:行者123 更新时间:2023-12-05 09:24:38 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Convert a JSON into a UTF-8 string

我正在缓存一些 Twitter 供稿以供长期使用。我的搜索结果产生了以下类型的数据结构:

"results": [
{
"created_at": "Sun, 08 Apr 2012 18:31:04 +0000",
"entities": {
"hashtags": [
{
"text": "cheeringfor",
"indices": [
54,
66
]
}
],
"urls": [

],
"user_mentions": [
{
"screen_name": "BenSpies11",
"name": "Ben Spies",
"id": 32124771,
"id_str": "32124771",
"indices": [
0,
11
]
}
]
},...

我试图将此输出的主题标签部分包含在我的数据库表中,但我试图将其保存为纯字符串。

我尝试将其转换为字符串,即 (string)$result->hashtags 但我收到了 cannot be converted to string 错误。我还尝试了 serialize() 函数,该函数有效但在我尝试取消序列化并取回我的对象​​时出现 php 错误。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com