Home >php教程 >php手册 >PHP如何随机读取多个文本

PHP如何随机读取多个文本

WBOY
WBOYOriginal
2016-06-06 19:40:511072browse

/*我直接在这打字了,懒得打开软件进行测试,你看得懂原理就行啦!*/ ?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('说完了...^_^');

?>

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