Home > Backend Development > PHP Tutorial > Php 读取json_decode数据的有关问题

Php 读取json_decode数据的有关问题

WBOY
Release: 2016-06-13 11:54:04
Original
852 people have browsed it

Php 读取json_decode数据的问题
有6条json数据数据如何让他随机 显示出来?
我用 
foreach ($content as $key) {
   echo $key->bucket_name; 
  }
他是按顺序显示出来的 要怎么才能让他随机显示出来 并且不重复 
求大神 解答 希望能给一下思路 但是有代码就跟好了 谢谢 
------解决方案--------------------
随机显示:shuffle
不重复:array_unique.
------解决方案--------------------

$content = shuffle($content); //打乱$content<br />foreach ($content as $key) {<br />   echo $key->bucket_name; <br />}
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template