Pagina 1 van 1

php vraag

Geplaatst: 19 nov 2004, 21:16
door DaMnNaTiOn
Hoe kan je automatisch http:// toevoegen voor www als http:// niet is teogevoegd?

Geplaatst: 20 nov 2004, 16:03
door Donny_nl
even 'geleend' uit m'n gastenboek:

Code: Selecteer alles

	//
	// Check if http:// is added with the url, if not -> now it is
	//

	if(substr($sGBurl,0,7) != 'http://')
	{
		$sGBurl = 'http://'.$sGBurl;
	}
Waarbij $sGBurl de variabele (website url) is natuurlijk

Geplaatst: 20 nov 2004, 16:14
door DaMnNaTiOn
thnx :thumb:

Geplaatst: 20 nov 2004, 16:56
door mosymuis
Binnen een post gebruik je dit

Code: Selecteer alles

preg_replace('/[^(http:\/\/)]www\./i', '\\1 http://www.', $str);