php - 为什么这个带有 getAttribute 的 PHP DOM 解析不起作用?
问题描述
从这个页面,我想得到带有名字value
的input
标签form_key
。但我收到以下错误:
Fatal error: Uncaught Error: Call to undefined method simple_html_dom::getAttribute() in test.php:9 Stack trace: #0 {main} thrown in test.php on line 9
请注意,我使用的是 PHP Simple DOM 解析器。
PHP:
include('simple_html_dom.php');
$html = file_get_html('https://b2b.chiemsee.com/customer/account/login/');
if($html->getAttribute('name') =='form_key'){
echo $html->nodeValue;
}
解决方案
推荐阅读
- java - 如何在 JOGL 中正确使用照明?
- php - Symfony - 在 null 上调用成员函数 setFunction()
- scala - Scala - 类型推断不适用于数组作为函数 args
- algorithm - 加权作业调度 - 它是如何工作的
- python - 在 python 中使用 pandas 计算滚动季度(替代方案?)
- javascript - DataTable 不是函数的错误
- php - Simplenews 通讯网址?
- java - 在不同时区之间格式化时间的正确方法是什么?
- python - 四舍五入到任何给定值python
- mysql - 如何根据 A 列中的数据将 B 列的 SQL 搜索结果汇总为总和?