我想在本地主機上學習HTML DOM解析。但是我在開始時就崩潰了。簡單的HTML DOM解析無法正常工作
1)我做了一個新的項目
2)我從simplehtmldom.sourceforge.net
3下載的文件)我已經把這段代碼我的HTML項目
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
// put your code here
$html = file_get_html('http://www.google.com/');
?>
</body>
</html>
4)我進去這個錯誤,當我運行腳本時:
致命錯誤:未捕獲錯誤:調用未定義的函數file_get_html()在C:\ xampp \ htdocs \ PhpProject1 \ index.php:15 Stac k trace:在第15行拋出C:\ xampp \ htdocs \ PhpProject1 \ index.php中的#0 {main}
我在這裏誤解了什麼嗎?
您需要使用DOM解析器。詳細信息[這裏](https://sourceforge.net/projects/simplehtmldom/files/) –
@AshiqurRahman我已經下載了這些文件,並將它們放在我的項目文件夾中 – ragulin
您需要在HTML代碼中包含DOM解析器PHP庫文件。 –