Home > php教程 > php手册 > PHP 取得一个页面上的所有超链接函数

PHP 取得一个页面上的所有超链接函数

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:39:37
Original
874 people have browsed it

取得一个页面上所有超链接的简单函数:

  1. function get_all_url($cnstr){
  2.         preg_match_all(/" ] )["|]?s*[^>]*>([^>] )/i,$cnstr,$arr);
  3.         return array(name=>$arr[2],url=>$arr[1]);
  4. }

  5. //调用函数
  6. $url = www.ite5e.com;
  7. echo get_all_url($url);
  8. ?>

使用很简单,传一个URL地址进去就可以啦。

Related labels:
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template