CKTIS / PHP
urlencode()
Codeert één formulier- of querywaarde als application/x-www-form-urlencoded.
Versie: PHP 8.4; repository runtime, production runtime not attested
Syntax
urlencode(string $string): stringCodeert één formulier- of querywaarde als application/x-www-form-urlencoded. Spatie wordt plus, plus wordt %2B en tilde wordt %7E. De hele query coderen zou ook de scheidingstekens veranderen.
Signatuur
urlencode(string $string): string
Uitvoer van het voorbeeld
q=C%2B%2B+notes%7E&page=2
Voorbeelden
<?php
echo "q=", urlencode("C++ notes~"), "&page=2";
Resultaat
q=C%2B%2B+notes%7E&page=2