简单的HTML Dom以href开头

时间:2015-04-15 06:10:55

标签: simple-html-dom

我正在使用Simple HTML Dom从远程源中提取信息。我想获得包含特定文本的所有href链接(不是全部在页面上)。我试过了

->find('a[href*="/place"]')

->find('a[href="/place"*]')

->find('a[href="/place*"]')

但这会返回空结果。

我想要的href必须以文本“/ place”开头。

有什么建议吗? 感谢

2 个答案:

答案 0 :(得分:0)

我现在不用这个应用程序,但你是否尝试使用这样的星号?

>find('a[href="/place*"]')

答案 1 :(得分:0)

匹配具有指定属性且以特定值开头的元素,使用[attribute^=value]

->find('a[href^="/place"]')

参考:http://simplehtmldom.sourceforge.net/manual.htm#frag_find_attr

相关问题