从字符串中提取所有<a href="#">#</a>标记的最佳方法是什么?

时间:2015-11-02 15:10:33

标签: php html html-parsing

我目前正在使用CakePHP 3.x框架,并且我需要从文本中提取所有<a hrefs="#">#</a>的新函数,但我不知道最好的方法。

示例:

// String wich contains <a hrefs="#">#</a> tags 
$string = "This is a small <a href="#">text</a> to create a <a href="#">example</a>"; 

// output
Link 1: <a href="#">text</a>
Link 2: <a href="#">example</a>

0 个答案:

没有答案
相关问题