Home > php教程 > php手册 > body text

PHP如何随机读取多个文本

WBOY
Release: 2016-06-06 19:40:51
Original
1043 people have browsed it

/*我直接在这打字了,懒得打开软件进行测试,你看得懂原理就行啦!*/ ?php $say = array( /*这个一维数组里面有100句话*/ ); $key = array_rand($say,8);// 随机 取出8个键 for($i=1;$i=8;$i++){ echo '第'.$i.'句话:'.$say[$key[$i]].'br /'; } die('说完

/*我直接在这打字了,懒得打开软件进行测试,你看得懂原理就行啦!*/

  $say = array( /*这个一维数组里面有100句话*/ );

  $key = array_rand($say,8);//随机取出8个键

  for($i=1;$i

    echo '第'.$i.'句话:'.$say[$key[$i]].'
';

  }

  die('说完了...^_^');

?>

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!