Jump to content
php.lv forumi

Vai tas ir korekti?


Raiviic

Recommended Posts

<?

$text=$tmp3[1];

$text_apstrade=preg_replace("(((http://www[^ ]+))|(((www[^ ]+)))|((http[^ ]+)))", "<a target=\"_blank\" style=\"text-decoration: none\" href=\"$0\" ><b>°links </b></a>", $text);

$text_apstrade = str_replace("http://www","www", $text_apstrade);

$text_apstrade = str_replace("www","http://www", $text_apstrade);

print($text_apstrade);

?>

 

 

vai shads pieraksts ir korekts?

Link to comment
Share on other sites

strādā ?

 

nez, es lietotu kaut ko šitādu.

$text=str_replace("www", "http://www", $text);
$text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\" target=\"_blank\">\\0</a>", $text);

tas pārveidos arī ftp:// utt adreses.

 

nez, varbūt jau preg_replace lietot ir pareizāk, bet es kaut kā esmu ar šito ereg_replace pieradis.

Link to comment
Share on other sites

×
×
  • Create New...