我有一个以秒为单位关联 mp3 文件及其各自长度的数组
$playlist = array( array("song" => "01.mp3","min" => "91"),
array("song" => "02.mp3","min" => "101"),
array("song" => "03.mp3","min" => "143"),
array("song" => "04.mp3","min" => "143"),
array("song" => "05.mp3","min" => "151")
);
我从播放列表中挑选一首歌array_rand()
...
$song = $playlist[array_rand($playlist)];
然后,稍后,我访问该数组中的值...
echo $song['song'];
//Then somewhere else...
echo $song['min'];
我的问题是,每次我请求$song
时,它会产生随机结果,还是每次页面加载只产生一次随机结果?(即,一旦 $song 被定义,它就被定义好了。) ...我希望是后者。