$text = preg_replace ( '/\<a.+?href\="(.+?)".+?\>/i' , 'http://mioserver/$1' , $text ) ;
Chiamatemi sven se volete non ho voglia di fare una nuova email per una nuova registrazione xD
Mac Future User , Ventilatore for PC Cooler user , - dry is coming -
$text = preg_replace ( '/\<a.+?href\="^(http)(.+?)".+?\>/i' , 'http://mioserver/$1' , $text );
Chiamatemi sven se volete non ho voglia di fare una nuova email per una nuova registrazione xD
Mac Future User , Ventilatore for PC Cooler user , - dry is coming -
piccolo errore, sucsa
cosi puoi fare tutto i controlli che vuoi: nella funzione check_url la variabile $url corrisponde alla stringa che trova il preg_replaceCodice PHP:
function check_url ( $url )
{
if ( preg_match ( '/^([A-Za-z]+\:\/\/)/i' , $url ) )
{
return $url ;
}
else if ( preg_match ( '/^(www\.)/i' , $url ) )
{
return $url ;
}
else
{
return 'http://www.sito.com/' . $url ;
}
}
$text = '[url="www.hciccio/pahgina.php"]asdfsdfasdf[/url]' ;
$text = preg_replace ( '#\<a.+?href\="(.+?)".+?\>#ei' , 'check_url("$1")' , $text );
echo $text ;
Chiamatemi sven se volete non ho voglia di fare una nuova email per una nuova registrazione xD
Mac Future User , Ventilatore for PC Cooler user , - dry is coming -
Grazie mille !
![]()