给定字符串,开始字符和结束字符获取中间的字符串
function GetBetween($content,$start,$end){ $r = explode($start, $content); if (isset($r[1])){ $r = explode($end, $r[1]); return $r[0]; } return ''; } //演示范例: GetBetween('foo test bar', 'foo', 'bar'); // --> returns ' test ';
给定字符串,开始字符和结束字符获取中间的字符串
function GetBetween($content,$start,$end){ $r = explode($start, $content); if (isset($r[1])){ $r = explode($end, $r[1]); return $r[0]; } return ''; } //演示范例: GetBetween('foo test bar', 'foo', 'bar'); // --> returns ' test ';