|
![]() |
名片设计 CorelDRAW Illustrator AuotoCAD Painter 其他软件 Photoshop Fireworks Flash |
|
<?php function validateEmail($email) { return eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$", $email); } function validateURL($url) { return eregi("^((ht|f)tp://)((([a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3}))|(([0-9]{1,3}.){3}([0-9]{1,3})))((/|?)[a-z0-9~#%&\\'_+=:?.-]*)*)$", $url); } function convertURLS($text) { $text = eregi_replace("((ht|f)tp://www.|www.)([a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})((/|?)[a-z0-9~#%&\\/\\'_+=:?.-]*)*)", "http://www.\\3", $text); $text = eregi_replace("((ht|f)tp://)((([a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3}))|(([0-9]{1,3}.){3}([0-9]{1,3})))((/|?)[a-z0-9~#%&\\'_+=:?.-]*)*)", "<a href="\\0">\\0</a>", $text); return $text; } function convertMail($text) { $text = eregi_replace("([_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3}))", "<a href=\\'mailto:\\0\\'>\\0</a>", $text); return $text; } function convertAllLinks($text) { $text = convertURLS($text); $text = convertMail($text); return $text; } ?> 返回类别: 教程 上一教程: 也谈 PHP 和 MYSQL 下一教程: 一个用数据库的php二级联动 您可以阅读与"Email+URL的判定和自动转变函数"相关的教程: · 一个高ai的分页函数和一个url函数 · 正则表达式判定email和URL, 帮忙看看有没有要补充的. · PHP设计福利彩票幸运号码自动生成器 · php通用检测函数集(5) · PHP 和 XML: 使用expat函数(二) |
![]() ![]() |
快精灵印艺坊 版权所有 |
首页![]() ![]() ![]() ![]() ![]() ![]() ![]() |