par
Elie » 08 juil. 2014, 20:54
Hello,
J'ai besoin pour une magouille de faire apparaitre ma fonction et mes attributs dans l"url :
Je voudrais lancer : cacheFichier($url, $path);
Je lancer donc mon url fonction.php?fonction=cacheFichier&attr
=LURL&attr[path]=../../
Mon fichier PH ... func_array
call_user_func_array($_GET['fonction'], $_GET['attr'])
Merci,
Elie
Hello,
J'ai besoin pour une magouille de faire apparaitre ma fonction et mes attributs dans l"url :
Je voudrais lancer : cacheFichier($url, $path);
Je lancer donc mon url fonction.php?fonction=cacheFichier&attr[url]=LURL&attr[path]=../../
Mon fichier PHP ressemble à ca :
[php]if(function_exists($_GET['fonction'])) {
echo $_GET['fonction'](implode(', ', $_GET['attr']));
}[/php]
Le implode en fait ne fonctionne pas comme je le desire.
Pour lui il n'a qu'un seul attribut qui est un array()...
Est-ce que c'est possible ?
EDIT : 21h15
J'ai fait ce que je conseille a tout le monde faire, c'est à dire chercher !
Et découvert la fonction adéquate qui ne me reservira surement jamais mais qui existe pourtant : [url=http://fr2.php.net/manual/fr/function.call-user-func-array.php]call_user_func_array[/url]
[php]call_user_func_array($_GET['fonction'], $_GET['attr'])[/php]
Merci,
Elie