PHP 截取指定字符串后的字符串

function intercept_str($start,$end,$str)
{
if(empty($start)||empty($end)||empty($str))return "参数不正确";
$strarr=explode($start,$str);
$str=$strarr[1];
$strarr=explode($end,$str);
return $strarr[0];
}
echo intercept_str("","",$str);

调用方法:intercept_str('开始字符串','结束字符串','源字符串')

如:调用intercept_str('I','you','I miss you') 将返回' miss '

你可能感兴趣的:(php)