我有一个具有这种结构的数组:
Array
(
[mysite] => Array
(
[0] => Array
(
[0] => uniqueid
[1] => brand
[2] => horsepower
[3] => topspeed
)
[1] => Array
(
[0] => uniqueid
[1] => brand
[2] => horsepower
[3] => topspeed
)
[2] => Array
(
[0] => uniqueid
[1] => brand
[2] => horsepower
[3] => topspeed
)
)
)
每辆车都有一个“独特的”,然后是品牌、马力等。
如果我想获取随机汽车的信息,我会这样做:
$rkey = array_rand($sites['mysite'], 1); // get a random key
$car_info = $myarray['mysite'][$rkey];
您对如何使用某个“唯一标识”获取信息有任何想法吗?
$car_info = "get the information of a car with a certain uniqueid";
泰!