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

Php 读取json_decode数据的有关问题

WBOY
WBOYOriginal
2016-06-13 11:54:04832browse

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 />}

Statement:
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