###前提・実現したいこと
HTMLをスクレイピングするコードなのですが、以下の
変数=変数=
の意味がわかりません。
教えてください。宜しくお願い致します。
php
1$res = $res = simplexml_load_string($tidy);
###元のソースコード
php
1<?php 2 3ini_set('display_errors', true); 4error_reporting(E_ALL); 5 6$html = <<<HTML 7<!DOCTYPE HTML> 8<html lang="ja"> 9 <head> 10 <meta charset="UTF-8"> 11 <title>タイトル</title> 12 </head> 13 <body> 14 <div> 15 <ul> 16 <span>span</span> 17 <div> 18 <li>li1</li> 19 <li>li2 20 <li>li3</li> 21 </body> 22</html> 23HTML; 24 25$config = array( 26 'drop-empty-elements' => false, // 空の要素を削除しない 27 'hide-comments' => true, // コメントを削除 28 'output-xhtml' => true, // xhtml に変換 29); 30 31$tidy = new tidy(); 32$tidy->parseString($html, $config, 'utf8'); 33$tidy->cleanRepair(); 34 35$res = $res = simplexml_load_string($tidy); 36var_dump($res);
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。