1
I wonder what it means when someone uses it $_GET['path']
? What would be the path
? I thought the $_GET
would only receive information from the URL.
public function get_url_data () {
// Verifica se o parâmetro path foi enviado
if ( isset( $_GET['path'] ) ) {
// Captura o valor de $_GET['path']
$path = $_GET['path'];
// Limpa os dados
$path = rtrim($path, '/');
$path = filter_var($path, FILTER_SANITIZE_URL);
// Cria um array de parâmetros
$path = explode('/', $path);
// Configura as propriedades
$this->controlador = chk_array( $path, 0 );
$this->controlador .= '-controller';
$this->acao = chk_array( $path, 1 );
// Configura os parâmetros
if ( chk_array( $path, 2 ) ) {
unset( $path[0] );
unset( $path[1] );
// Os parâmetros sempre virão após a ação
$this->parametros = array_values( $path );
}Fim if
If possible state what is path
.
$_GET
is different fromget['']
!!! maybe thisget
be another thingarray
– novic
As far as I know this doesn’t exist, maybe it’s an array created in your code called
$get
which contains the elementpath
. What exists is$_GET['parametro']
– Paulo Roberto Rosa
sol25lua, put the code where it is. Without the context it is impossible to say. You should have noticed this in your other questions, which you only answered when you posted the code. Please pay more attention when asking here and read the guide to [Ask].
– Woss
All right I’m sorry I’ll post in full, I’ll edit the question
– sol25lua
@sol25lua need not apologize for anything stay quiet ... Slowly getting the hang of it ...
– novic
Yes, the
$_GET
takes information passed to the url itself.$_GET['path']
will take the value of a parameter calledpath
present in the URL, if this parameter exists.– bfavaretto
Because I amaze him with the
path
? Nothing complicated, you see:http://dominio.com?nome=sol25lua
ORhttp://dominio.com?path=sol25lua
recovering the value$_GET['nome']
OR$_GET['path']
both returnsol25lua
– user60252
The $_GET method is used to receive variables through the URL (Link that inserts in the browser), surely you have seen on some websites a link this way
www.exemplo.com/index.php?path=sol25lua
. The point of ? is the way to declare that the following are variables. After ? we can start declaring the variables. in this example we are defining the variablepath
with the valuesol25lua
– user60252
I get it, but if there’s more than one parameter in the URL, like this: http://domain.com?nomen=sol25lua? city=Curitiba to recover the value of $_GET['path'] what would be the result? sol25luacuritiba?
– sol25lua
I don’t understand why every time a newbie shows up, who still doesn’t have a full understanding of Stark’s workings, they shoot to give him negative points. It should be the other way around to stimulate learning so that he becomes a member of this community and in the future help! + 1 @sol25lua next time only post formatted question!
– Rafael Salomão
If the url has more than one parameter you can access the values by the name given in the url, in your example above you would access $_GET['name'] would have the sol25lua value and $_GET['city'] would have the Curitiba value. $_GET and $_POST are global php scope variables. So they can be accessed from any part of the script.
– Rafael Salomão