1
I created a function php
that is returning me a mistake:
Notice: Undefined index: url... on line 2.
I’m giving away $_GET
in $url
wrongly?
function getHome()
{
$url = $_GET['url'];
$url = explode('/', $url);
$url[0] = ($url[0] == NULL ? 'index' : $url[0]);
if(file_exists('tpl/'.$url[0].'.php')){
require_once('tpl/'.$url[0].'.php');
}elseif(file_exists('tpl/'.$url[0].'/'.$url[1].'.php')){
require_once('tpl/'.$url[0].'/'.$url[1].'.php');
}else{
require_once('tpl/404.php');
}
}
I think it is because in the url there is no parameter that is called
url
. do so to test: www.seusite.com? url=hello/hello. Basically add?url=ola/hello
at the end of the url and see the result– Miguel
Got it, it’s not getting any parameters, so from notice, there would be some way when to nullify the auto url to "? url=index"?
– Ricardo Feller