Je ne comprends pas, j'ai un script php qui lit dans un fichier "status.txt" contenant ceci :
Voici le script PHP :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 Online Online Offline Online Offline Online Online
J'ai laissé en commentaires car cela ne fonctionnait pas, j'ai l'impression que la comparaison au niveau du "if($Ligne=="Online")" ne se fait pas...De plus si je mets le "Else" il me sort une erreur me disant qu'il ne devrait pas y en avoir...Il affiche cependant bien le contenu de "status.txt" lors de l'appel
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63 <?php $fichier = fopen("status.txt","r"); while(!feof($fichier)) { // On récupère une ligne $Ligne = fgets($fichier,255); // On affiche la ligne echo $Ligne; } // On ferme le fichier fclose($fichier); // On affiche affiche les images //if($Ligne == "Online") //$game1 = "<img src = http://ninjaaior.free.fr/ouvert1.jpg>"; //$game2 = "<img src = http://ninjaaior.free.fr/ouvert2.jpg>"; //$game3 = "<img src = http://ninjaaior.free.fr/ouvert3.jpg>"; //$game4 = "<img src = http://ninjaaior.free.fr/ouvert4.jpg>"; //$game5 = "<img src = http://ninjaaior.free.fr/ouvert5.jpg>"; //$game6 = "<img src = http://ninjaaior.free.fr/ouvert6.jpg>"; //$game7 = "<img src = http://ninjaaior.free.fr/ouvert7.jpg>"; //else //$game1 = "<img src = http://ninjaaior.free.fr/ferme1.jpg>"; //$game2 = "<img src = http://ninjaaior.free.fr/ferme2.jpg>"; //$game3 = "<img src = http://ninjaaior.free.fr/ferme3.jpg>"; //$game4 = "<img src = http://ninjaaior.free.fr/ferme4.jpg>"; //$game5 = "<img src = http://ninjaaior.free.fr/ferme5.jpg>"; //$game6 = "<img src = http://ninjaaior.free.fr/ferme6.jpg>"; //$game7 = "<img src = http://ninjaaior.free.fr/ferme7.jpg>"; ?> <html> <body> <table width="130" height="56"> <tr> <td width="10"></td> <td align="left"><?php echo $game1; ?></td> </tr> <tr> <td width="10"></td> <td align="left"><?php echo $game2; ?></td> </tr> <tr> <td width="10"></td> <td align="left"><?php echo $game3; ?></td> </tr> <tr> <td width="10"></td> <td align="left"><?php echo $game4; ?></td> </tr> <tr> <td width="10"></td> <td align="left"><?php echo $game5; ?></td> </tr> <tr> <td width="10"></td> <td align="left"><?php echo $game6; ?></td> </tr> <tr> <td width="10"></td> <td align="left"><?php echo $game7; ?></td> </tr> </table> </body> </html>Bien entendu lorsque j'enlève les commentaire je place ceci
Code : Sélectionner tout - Visualiser dans une fenêtre à part echo $Ligneaprès l'affichage des images.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 } // On ferme le fichier fclose($fichier);
Si quelqu'un peut m'aider ça serait génial
Merci d'avance.
Partager