get meta description tag with xpath

后端 未结 5 2021
生来不讨喜
生来不讨喜 2021-02-07 06:39

I need the content the description and the keywords tag content. I have this code, but dont write anything. Idea?

$str = <<< EOD



        
5条回答
  •  耶瑟儿~
    2021-02-07 07:08

    In stead of including the /html/head part you could also use double slash which means that the following node can be anywhere in the code:

    //meta[@name='description']
    

    Will give the same result as:

    /html/head/meta[@name='description']
    

    Doesn't really matter much but it's less typing...

提交回复
热议问题