Home  >  Article  >  Backend Development  >  PHP随机获取标签内容解决方案

PHP随机获取标签内容解决方案

WBOY
WBOYOriginal
2016-06-13 11:49:01889browse

PHP随机获取标签内容
demo.txt


这是1


这是2


这是3


这是4


这是5



请问PHP如何随机获取demo文件内某个P标签内的内容。譬如随机输出:这是3
------解决方案--------------------
$ar = preg_grep('/

shuffle($ar);
echo $ar[0];
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