Salut à tous ! Help me please je m'arrache les cheveux
Depuis une page nommé Select.php je fais un autoload de deux classes, afin d'injecter des tableaux issus de la 1ere, dans la deuxieme. Jusque là tout va bien. Maintenant je souhaite stocker un de ces tableaux ( tableau d'objets simpleXml) dans une variable de session, et là tout va mal : ca marche pour des variables de type string mais avec mes tableaux, pourtants déclarés en public eux aussi !
Je n'utilise pas le session_register comme mentionné dans la documentation php 5 ...
La page :
La classe source :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 <?php function __autoload($class_name) { require_once $class_name . '.php'; } session_start(); $t=$_GET['theme']; $d=$_GET['diapo']; if(isset($t)){ $instance = new ParcourClass(); $instance->Partheme($t); $N=$instance->tabNom; $C=$instance->tabChem; $InstMin = new ClassMin($N,$C,$D); $Navigateur=$InstMin->return_browser(); $InstMin->miniatures($Navigateur); $InstMin->finpage(); $_SESSION['courant']=$instance->test; //Marche $_SESSION['courant']=$Navigateur; //Marche $_SESSION['courant']=$instance->tabNom; /* Warning: session_start() [function.session-start]: Node no longer exists in C:\laetitia\site\Phototheque\v.Class\Select.php on line 5 Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\laetitia\site\Phototheque\v.Class\Select.php:5) in C:\laetitia\site\Phototheque\v.Class\Select.php on line 5 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\laetitia\site\Phototheque\v.Class\Select.php:5) in C:\laetitia\site\Phototheque\v.Class\Select.php on line 5 3array(3) { [0]=> Warning: var_dump() [function.var-dump]: Node no longer exists in C:\laetitia\site\Phototheque\v.Class\Select.php on line 43 object(SimpleXMLElement)#1 (0) { } [1]=> Warning: var_dump() [function.var-dump]: Node no longer exists in C:\laetitia\site\Phototheque\v.Class\Select.php on line 43 object(SimpleXMLElement)#2 (0) { } [2]=> Warning: var_dump() [function.var-dump]: Node no longer exists in C:\laetitia\site\Phototheque\v.Class\Select.php on line 43 object(SimpleXMLElement)#3 (0) { } } */ } if(isset($d)){ echo $d; echo var_dump($_SESSION['courant']); }
Une idée ?!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 class ParcourClass { public $tabChem=array(); public $tabNom=array(); public $tabDesc=array(); public $xml; public $test; public function __construct(){ $this->xml= simplexml_load_file("Fic.xml"); $this->test="testok"; } public function Partheme($Theme){ // $theme est fourni en parametre ds Select.php $requeteNomFic='/racine/'.$Theme.'/photo/NomFic'; $requeteChem='/racine/'.$Theme.'/photo/Chemin'; $i=0; foreach ($this->xml->xpath($requeteNomFic) as $nom) { foreach ($this->xml->xpath($requeteChem)as $chem){ $this->tabChem[$i]= $chem; $this->tabNom[$i]=$nom; } $i++; } }//function xml }
Partager