如果此腳本檢測到,然後顯示所有#標籤,我該如何更改它,使它們都成爲超鏈接?基本上把它的一個<a href="#">
盈和</a>
背後如何將所有#標籤變爲超鏈接?
$str = <<<STR
this is a string
with a #tag and
another #hello one
STR;
$matches = array();
if (preg_match_all('/#([^\s]+)/', $str, $matches)) {
var_dump($matches[1]);
}
我不知道我理解。你能舉個例子嗎? – 2011-05-23 15:22:27
他希望'#tag'變成'#tag'。 – 2011-05-23 15:26:33