Autor | Zpráva | ||
---|---|---|---|
Visitor Profil * |
#1 · Zasláno: 31. 10. 2011, 12:19:28
<?php function MatchLink($url){ $url = Str_Replace("\\r","\r",$url); $url = Str_Replace("\\n","\n<br>",$url); $url = Str_Replace("\\n\\r","\n\r",$url); $in = Array('`((?:https?|ftp)://\S+[[:alnum:]]/?)`si', '`((?<!//)(www\.\S+[[:alnum:]]/?))`si' ); $out = Array("<a href=\"$1\" rel=\"nofollow\">$1</a>", "<a href=\"http://$1\" rel=\"nofollow\">$1</a>" ); return Preg_Replace($in, $out, $url); } echo MatchLink("nejaká moja adresa, ktorú chcem zakódovať... http://addr.org/");[/pre] |
||
Taps Profil |
#2 · Zasláno: 31. 10. 2011, 12:45:32
Visitor:
return Preg_Replace($in, $out, rawurlencode$url)); |
||
Visitor Profil * |
#3 · Zasláno: 31. 10. 2011, 12:49:22
V tom riešení máš chybu, a aj tak to nefunguje ako má.
|
||
Časová prodleva: 12 let
|
0