parse_url() (funzione PHP) restituisce, sotto forma di array associativo, il parsing di un URL.
tips&tricks
Sintassi
parse_url($url, $componente[facoltativo])
| parametro | descrizione |
|---|---|
| $url | L’URL da processare |
| $componente | Il componente al quale limitare la funzione, secondo le seguenti costanti PHP_URL_SCHEME PHP_URL_HOST PHP_URL_PORT PHP_URL_USER PHP_URL_PASS PHP_URL_PATH PHP_URL_QUERY PHP_URL_FRAGMENT |
Esempi
print_r(parse_url("http://www.gestiolex.it:8080/sottocartelle/pagina?query=uno&due#tre"));
/* RISULTATO
Array
(
[scheme] => http
[host] => www.gestiolex.it
[port] => 8080
[path] => /sottocartelle/pagina
[query] => query=uno&due
[fragment] => tre
)
*/
Contenuti correlati
- CSS
- HTML
- JavaScript
- jQuery
- PHP
- SQL
- WORDPRESS
0 Comment