PHP String Manipulation: Extract hrefs

后端 未结 4 1913
臣服心动
臣服心动 2020-11-29 13:22

I have a string of HTML that I would like to check to see if there are any links inside of it and, if so, extract them and put them in an array. I can do this in jQuery with

4条回答
  •  无人及你
    2020-11-29 13:58

    if the format is always the same, u can probably sort it out with a combination of explode and strip_tags something like

     $html="whatever"
    
    
     $href=end(explode('"',strip_tags($html)));
    

提交回复
热议问题