0 html php dom simple-html-dom laravel-5
我想在Laravel项目中使用simple_html_dom。但是我无法将此包添加到我的项目中。
如何在laravel中使用simple_html_dom?
有几种方法,其中一种是使用作曲器的。从命令行运行此命令:
composer require sunra/php-simple-html-dom-parser
Run Code Online (Sandbox Code Playgroud)
用法示例:
use Sunra\PhpSimple\HtmlDomParser;
$document = HtmlDomParser::str_get_html($html_text);
$document->find($selector);
Run Code Online (Sandbox Code Playgroud)