Ver Mensaje Individual
  #4 (permalink)  
Antiguo 07/07/2017, 08:35
Avatar de xfxstudios
xfxstudios
 
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 10 meses
Puntos: 263
Respuesta: Reconocer url

y porque no haces una funcion fuera del while que procese el texto y te retorne la respuesta, aqui una muestra con un array:

Código PHP:
Ver original
  1. $texto = array(
  2.             'Este es el Enlace 1 http://muestradeenlace1.com',
  3.             'Este es el Enlace 2 http://muestradeenlace2.com',
  4.             'Este es el Enlace 3 http://muestradeenlace3.com',
  5.             'Este es el Enlace 4 http://muestradeenlace4.com',
  6.             );
  7.  
  8. function enlace($X){
  9.     $text = $X;
  10.     $text = preg_replace("#http://[a-z0-9._/-]+#i", "<a href='$0'>$0</a>", $text);
  11.     $regex = "#[ ]+(www.([a-z0-9._-]+))#i";
  12.     $text = preg_replace($regex," <a href='http://$1'>$1</a>", $text);
  13.  
  14.     return $text;
  15. }
  16.  
  17. foreach ($texto as $key => $value) {
  18.     echo "<li>".enlace($value)."</li>";
  19. }

a mi me funciono perfecto así, tambien lo probe con una consulta a mysql y realizó el trabajo tambien.
__________________
[email protected]
HITCEL