<?php $url='http://www.cnblogs.com/tinyphp/p/3234926.html'; //当页已留邮箱 $content=file_get_contents($url); //获取页面内容 function getEmail($str) { //匹配邮箱内容 $pattern = "/([a-z0-9-_.]+@[a-z0-9]+.[a-z0-9-_.]+)/"; preg_match_all($pattern,$str,$emailArr); return $emailArr[0]; } print_r( getEmail($content)); ?>
留下我的邮箱做个测试:tinyphp@163.com