3
使用Symfony的DomCrawler如何從HTML源文件提取元描述? http://symfony.com/doc/current/components/dom_crawler.htmlSymfony的DomCrawler如何從HTML源文件提取元描述
$crawler = new Crawler();
$crawler->addHtmlContent($html->content, 'UTF-8');
$title = $crawler->filter('title')->text();
例MSN meta描述
<meta name="description" content="The new MSN, Your customizable collection of the best in news, sports, entertainment, money, weather, travel, health, and lifestyle, combined with Outlook, Facebook, Twitter, Skype, and more."/>