【问题标题】:To get image src with phpquery from html page使用 phpquery 从 html 页面获取图像 src
【发布时间】:2012-07-27 09:54:38
【问题描述】:

如何从 html 页面获取带有 phpQuery 的 img src? 补充:我需要让这个'src'在drupal的解析器模块中使用

【问题讨论】:

  • 我已经定义了它,并让它适用于另一种类型的内容,例如p、div等

标签: phpquery


【解决方案1】:

这是一个简短的例子

$imgsrc = pq('div#foo img.pic')->attr('src'); 

【讨论】:

  • 尝试在这段代码中使用 $page->find('div.text.img ->attr('src')')->html();但得到 t_string 错误
  • 试试这个 $page->find('div.text.img')->attr('src')->html();
猜你喜欢
  • 2017-11-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-06-30
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多