-3

我有php数组

Array(
[0] => Array
    (
        [boxId] => 917
        [contentId] => 72
        [sectionType] => hp_spl_contestants
        [contentTypeId] => 83
        [categoryId] => 0
        [countryId] => 5
        [data] => {"title":"Contestant No.1","button_txt":"Latest From","image":"2d4f8f52d49d1ab9930bc40157013a31.jpg","author":"Meenakshi Negi","url":"","date":"2012-10-04 18:16:30","badget":0,"badget_date":""}
        [insertDate] => 2012-10-05 21:05:57
        [sortorder] => 1
        [sitename] => bb6
    )

[1] => Array
    (
        [boxId] => 918
        [contentId] => 63
        [sectionType] => hp_spl_contestants
        [contentTypeId] => 83
        [categoryId] => 0
        [countryId] => 5
        [data] => {"title":"Contestant No.2","button_txt":"Latest From","image":"37154a5322838f61fb60cc24c8b5fe04.jpg","author":"Meenakshi Negi","url":"","date":"2012-10-04 18:09:06","badget":0,"badget_date":""}
        [insertDate] => 2012-10-05 21:06:16
        [sortorder] => 2
        [sitename] => bb6
    )

[2] => Array
    (
        [boxId] => 919
        [contentId] => 64
        [sectionType] => hp_spl_contestants
        [contentTypeId] => 83
        [categoryId] => 0
        [countryId] => 5
        [data] => {"title":"Contestant No.3","button_txt":"Latest From","image":"f90ba1195b1dd5a57308b46e1b248d49.jpg","author":"Meenakshi Negi","url":"","date":"2012-10-04 18:09:06","badget":0,"badget_date":""}
        [insertDate] => 2012-10-05 21:06:36
        [sortorder] => 3
        [sitename] => bb6
    )

[3] => Array
    (
        [boxId] => 920
        [contentId] => 65
        [sectionType] => hp_spl_contestants
        [contentTypeId] => 83
        [categoryId] => 0
        [countryId] => 5
        [data] => {"title":"Contestant No.4","button_txt":"Latest From","image":"d439ab109de8202914ea7439c1f7650b.jpg","author":"Meenakshi Negi","url":"","date":"2012-10-04 18:09:06","badget":0,"badget_date":""}
        [insertDate] => 2012-10-05 21:06:55
        [sortorder] => 4
        [sitename] => bb6
    )

我们可以随机化这个数组的值吗

4

2 回答 2

2

您可以使用随机播放功能。

shuffle($cdata);
于 2012-10-06T14:18:19.647 回答
0

shuffle() 和 array_rand() 会有所帮助

http://php.net/manual/en/function.array-rand.php

http://php.net/manual/en/function.shuffle.php

于 2012-10-06T14:27:24.167 回答