1
PHPの専門家。PHPのsimple_html_domパーサーでエラー
simple_html_domクラスの使用中にエラーが見つかりました。
私のHTML文字列を解析する必要があります。私が見つける(「メタ[名=画像]」)でメタタグという名前の画像を取得しようとしました
<!DOCTYPE html>
<html lang="en">
<head>
<title>Y-shaped ZnO Nanobelts Driven from Twinned</title>
<meta name="site" content="Reports"/>
<meta name="description" content="Description with twinned planes {11&#"/>
<meta name="image" content="https://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon.png?v=c78bd457575a"/>
...
</body>
</html>
は、しかし、私はできませんでした。
理由を調べたところ、上記の行の中央にある文字「&#」が原因であることが判明しました。
<meta name="description" content="Description with twinned planes {11&#"/>
私はこのケースでだから
Description with twinned planes {11&#"/> <meta name="image" ....
のようにそのmetaタグのcontent属性を持って、私はsimple_html_domが正しくHTMLを解析させるために何をすべきでしょうか?
それ以外の場合、このhtmlを正しく解析するライブラリはありますか?
のそれは{11&#は{11 &#なければならないことは問題ではありません –