【发布时间】:2021-01-24 15:36:20
【问题描述】:
我有一个 randquotes.json 文件
{
"author": "William Shakespeare",
"quotes": "A brave flea is a flea that can dare to get its breakfast on the lips of a lion."
},
{
"author": "Winston Churchill",
"quotes": "We live with what we get, but we bring life to what we give."
},
{
"author": "Wolfgang von Gothe",
"quotes": "Knowledge is not enough, we must practice it. Intention is not enough, we must do it."
}
然后我想用php随机生成“作者”和“引号”
怎么样? 感谢帮助
【问题讨论】:
-
你的意思是你想随机选择这些引号之一吗?
-
是的,我该怎么做?
-
能否先提供有效的JSON
-
你不知道:JSON 是实际事物的字符串表示,所以随机化 那些事物,然后将其转换为 JSON。