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

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

WBOY
Release: 2016-06-13 11:49:01
Original
909 people have browsed it

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


这是1


这是2


这是3


这是4


这是5



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

shuffle($ar);
echo $ar[0];
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template