ucym / CodeLapse

Fast coding for Small-scale PHP projects.
http://ucym.github.io/CodeLapse/
0 stars 1 forks source link

Introduction Sizzle like dom parser. #10

Open ucym opened 9 years ago

ucym commented 9 years ago

検討中のライブラリ

ファイルからHTMLを読み込んで"ul#nav"を検索し、その中の"li"を検索、そのli要素の内部のテキストをechoする。

<?php // PHP Simple HTML DOM Parser
$html = file_get_html('http://www.google.com/');

foreach ($html->find('ul#nav')->find('li') as $element) {
       echo $element->plaintext;
}
<?php // phpQuery
// TODO