<?php
$text = "123456789";
//保存一段文字
echo substr($text,strripos($text,"5")+1);
//输出5之后内容
echo substr($text,0,strrpos($text,"5"));
//输出5之前内容
echo substr(substr($text,0,strrpos($text,"8")),strripos(substr($text,0,strrpos($text,"8")),"5")+1);
//输出5之后8之前的内容
?>
<?php
preg_match('/.*?<p>(\d*?)<\/p>.*?/', "<p>www.gmit.vip</p>", $res);
echo $res;
//输出 www.gmit.vip
?>
Last modification:November 18th, 2020 at 04:35 pm
如果觉得我的文章对你有用,请随意赞赏
双击文章内容区域可以给本文点赞哦,快来试试吧