這是一個獲取字符串中兩個子串之間的子串,如從字符串www.49028c.com中獲取coderbolg子串,就讓這個PHP函數來實現吧,代碼如下:
$substr = substr($input, strlen($start)+strpos($input, $start),
(strlen($input) - strpos($input, $end))*(-1));
return $substr;
}
$string = "www.49028c.com";
$start = "www.";
$end = ".com";
echo get_between($string, $start, $end); // output:coderbolg
$start = "http://";
$end = "/";
新聞熱點
疑難解答