我测试了,很好用
以前的一个,写地址直接显示图片:
打开./include/discuzcode.php
- function parseurl(&$message) {
- return preg_match("/\[code\].+?\[\/code\]/is", $message) ? $message :
- substr(preg_replace( array(
- "/(?<=[^\]a-z0-9-="'\\/])((https?|ftp|gopher|news|telnet|mms|rtsp):\/\/|www\.)([a-z0-9\/\-_+=.~!%@?#%&;:$\\()|]+)/i",
- "/(?<=[^\]a-z0-9\/\-_.~?=:.])([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4}))/i"
- ), array(
- "[url]\\1\\3[/url]",
- "[email]\\0[/email]"
- ), ' '.$message), 1);
- }
复制代码
替换成:
- function parseurl(&$message) {
- return preg_match("/\[code\].+?\[\/code\]/is", $message) ? $message :
- substr(preg_replace( array(
- "/(?<=[^\]a-z0-9-="'\\/])((https?|ftp|gopher|news|telnet|mms|rtsp):\/\/|www\.)([a-z0-9\/\-_+=.~!%@?#%&;:$\\()|]+)(.jpg|.png|.gif)/i",
- "/(?<=[^\]a-z0-9-="'\\/])((https?|ftp|gopher|news|telnet|mms|rtsp):\/\/|www\.)([a-z0-9\/\-_+=.~!%@?#%&;:$\\()|]+)/i",
- "/(?<=[^\]a-z0-9\/\-_.~?=:.])([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4}))/i"
- ), array(
- "[img]\\0[/img]",
- "[url]\\1\\3[/url]",
- "[email]\\0[/email]"
- ), ' '.$message), 1);
- }
复制代码
[ 本帖最后由 aaronzhang 于 2005-12-30 12:12 编辑 ] |