<?php function getDesByStr($str){ $s = strpos($str,"/"); $e = strpos($str,"-"); return substr($str,$s+1,$e-$s-1); } function getDesByPreg($str) { $result = array(); preg_match("/(?:\/)(.*)(?:\-)/i",$str, $result); return $result[1]; } $str="SIP/02869593131-0000059b"; echo getDesByStr($str); echo "</br>"; echo getDesByPreg($str); ?>
发表评论