Skip to content

Introduction Sizzle like dom parser. #10

@ucym

Description

@ucym

検討中のライブラリ

  • PHP Simple HTML DOM Parser
  • phpQuery

TODO

  • 各ライブラリが空のコレクションに対してどう動くか調べる
  • サンプルコードが正しいか検証

サンプル

ファイルから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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions