2
I have a code in php that has the function of picking the parameter ?capa=
with parse_str
<?php
$url = parse_url($_SERVER["HTTP_REFERER"]);
parse_str($url["query"],$queryString);?>
That and his code: <?php echo $queryString["capa"] ?>
but how to do isset function of the $_GET
in the $queryString
I mean, with the $_GET I would do this: $largura = isset($_GET ["largura"])?$_GET ["largura"]:"100%";
that is if it had no value in ?largura=
would receive 100%.
how to do this other way once the query string is interpreted with parse_str
?
I couldn’t understand the problem.
$largura = isset($_GET ["largura"])?$_GET ["largura"]:"100%";
doesn’t work ?– Isac
Yes it works, but this using $_GET, in my case I want to do using
<?php echo $queryString["capa"] ?>
– Matheus Vitor
But
$queryString
is an array ? Or you want to fetchcapa
also to the parameters of$_GET
?$capa = isset($_GET["capa"]) ? $_GET["capa"] : "outro_valor_que_dê_jeito";
? Your question is confused.– Isac
I this to get the information that comes from a site with reference:
<?php $url = parse_url($_SERVER["HTTP_REFERER"]);parse_str($url["query"],$queryString);?>
so I get the cover reference<?php echo $queryString["capa"] ?>
but what if I don’t have a cover, how to put a pattern ? and that’s what I try to talk about..– Matheus Vitor
All that you are using to interpret the values is relevant and should be in the question, otherwise it is not clear enough. Add this information to the question.
– Isac