Simple example of using PHP to determine whether there are pictures in an article

WBOY
Release: 2016-07-25 08:52:55
Original
821 people have browsed it
  1. $url="http://XXXXX/article/012.html";
  2.  $content=file_get_contents($url); //Read the article page source code
  3.  if(preg_match("/img/" ){
  4.  echo "Picture detected";
  5.  }else{
  6.  echo "Picture not found";
  7. }
Copy code

But to be honest, this method of judgment is too far-fetched

For examples of determining whether there are pictures in an article, please refer to the following article:

  • php preg_match_all matches pictures in articles
  • How to use php to process images in articles
  • How to filter pictures in articles using PHP regular rules
  • php uses preg_match_all to match pictures in articles


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template