royalmar / simple-html-dom-parser
该包最新版本(1.0.2)没有可用的许可证信息。
修改SimpleHtmlDom以兼容Laravel
1.0.2
2017-05-06 01:29 UTC
Requires
- php: >=5.3.3
This package is not auto-updated.
Last update: 2024-09-28 19:45:37 UTC
README
将Simple html dom库添加到Laravel中 更多文档:http://simplehtmldom.sourceforge.net/
##安装方法
composer require royalmar/simple-html-dom-parser
##Laravel配置 将服务提供者添加到config/app.php
'providers' => array(
...
'Royalmar\HtmlDomParser\HtmlDomParserServiceProvider',
//Laravel 5.1+
Royalmar\HtmlDomParser\HtmlDomParserServiceProvider::class,
...
在config/app.php中添加别名
'aliases' => array(
...
'HtmlDomParser' => 'Royalmar\HtmlDomParser\HtmlDomParser',
//Laravel 5.1+
'HtmlDomParser' => Royalmar\HtmlDomParser\HtmlDomParser::class,
...
##使用方法
$parser = new \HtmlDomParser(); // get html dom from file $html = $parser->fileGetHtml('http://www.google.com'); // get html dom from string $html = $parser->strGetHtml('<p>Hello World</p>'); //OR // get html dom from file $html = \HtmlDomParser::fileGetHtml('http://www.google.com'); // get html dom from string $html = \HtmlDomParser::strGetHtml('<p>Hello World</p>');