Bonjour,
Comment puis-je inclure un fichier PHP puisé au hasard dans un répertoire avec la fonction 'include' ? Mes fichiers se nomment 'input.php , input02.php, input03.php, etc. '
Merci pour votre aide.
:-)
Bonjour,
Comment puis-je inclure un fichier PHP puisé au hasard dans un répertoire avec la fonction 'include' ? Mes fichiers se nomment 'input.php , input02.php, input03.php, etc. '
Merci pour votre aide.
:-)
tu peux partir de ce code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 <?php $fichier = array("input01.php","input02.php","input03.php",...); $rand = rand(0,1); include($fichier[$rand]); ?>
Non, ici seuls les deux premières valeurs seraient sélectionnables.
Ce serait plutôt :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 <?php $fichier = array("input01.php","input02.php","input03.php",...); include($fichier[array_rand($fichier)]);
Partager