voici mon code.
si les url dans le texte sont deferents. pas souci.
si il y a des url qui sont les meme .mon code ne marche pas.
comment faire ,merci!
<?php
header("content-type:text/html;charset=utf-8");
$reg_exUrl = "#(http\:\/\/|https\:\/\/|ftp\:\/\/|ftps\:\/\/)?(www\.)?(\w\-?)+(\.\w+)+(\/*\S*)?#";
$text = "
monpub.com/deposer.html
monpub.com/deposer.html
monpub.com/deposer3.html
monpub.com/deposer4.html";
if(preg_match_all($reg_exUrl, $text, $url)) {
echo '<br>bon<br>';
$s=count($url[0])-1;
for($x=0;$x<=$s;$x++){
$text=str_replace(.$url[0][$x],"<a href=http://".$url[0][$x].">".$url[0][$x]."</a>",$text);
}
} else{
echo '<br>pas bon<br>';
}
echo $text;
?>