Home >Backend Development >PHP Tutorial >PHP code to extract the first picture on the page as a thumbnail

PHP code to extract the first picture on the page as a thumbnail

WBOY
WBOYOriginal
2016-07-25 08:42:21934browse
  1. $p = '//i';
  2. preg_match_all($ p,$str,$match);
  3. print_r($match[1][0]);
  4. ?>
Copy code

  1. The result is: http://usr .im/200x60?bg=3498DB&text=tool.lu
  2. The result is: http://img.it-home.org/data/attachment/forum/2016pic2/55c877240001291602790279-80-80.jpg
Copy code

The picture shows, the first one, PHP


Statement:
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