Globale variable avec GET
Bonjour j'ai un message d'erreur en utilisant $url = $_GET['url'];
voici le fichier index.php :
Code:
1 2 3 4 5 6 7 8 9 10
|
<?php
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', dirname(dirname(__FILE__)));
$url = $_GET['url'];
require_once (ROOT.DS.'framework'.DS.'init.php');
include ROOT.DS.'framework'.DS.'global'.DS.'main.php'; |
ensuite le fichier init.php :
Code:
1 2 3 4 5 6 7 8 9
|
<?php
global $url;
function callHook(){
$urlArray = array();
$urlArray = explode("/", $url);
...
} |
et la j'ai un message d'erreur :
"Notice: Undefined index: url in .../index.php"
"Notice: Undefined variable: url in .../init.php"
si dans le fichier index.php je mets require_once (ROOT.DS.'framework'.DS.'init.php'); en commentaires tout fonctionne....
Pourquoi dans le fichier init.php la variable globale $url n'est pas acceptee?
Merci