par
tetaklak123hop » 25 mars 2008, 15:54
Bon... Encore une galere...
Pour commencer, voici le code de ma page PHP qui doit afficher mon graphique...
Code : Tout sélectionner
<?php /* Date de création: 30/01/2008 */ ?>
<html>
<body background="/siteGSM/images/fond.jpg">
<?php
include ("C_GSM.php");
include ('jpgraph/jpgraph.php');
include ('jpgraph/jpgraph_line.php');
$ydata = array(8,3,16,2,7,25,16);
// Creation du graphique
$graph = new Graph(300,200);
$graph->SetScale("textlin");
// Création du système de points
$lineplot=new LinePlot($ydata);
// On rajoute les points au graphique
$graph->Add($lineplot);
// Affichage
$graph->Stroke();
?>
<DIV CLASS="page">
<CENTER>
<!-- vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv -->
<IMG SRC="courbe-d1.php?values=0.0;10.0;20.01;30.0;40.0;50.0;45.0;40.88;35.71;20.72;15.16;9.05;4.26;1.58;0.25;0.0;0.0;0.0;">
<IMG SRC="courbe-d2.php?values=0.0;100.0;90.01;80.0;70.0;60.0;50.0;20.88;18.71;16.72;15.16;9.05;4.26;1.58;0.25;0.0;0.0;0.0;">
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -->
</CENTER>
<BR><BR><BR>
</DIV>
</body>
</html>
Mais seulement, voila ce que mon navigateur me retourne
================================================================
JpGraph Error: HTTP headers have already been sent.
Caused by output from file CRCourbe.php at line 4.
Explanation:
HTTP headers have already been sent back to the browser indicating the data as text before the library got a chance to send it's image HTTP header to this browser. This makes it impossible for the library to send back image data to the browser (since that would be interpretated as text by the browser and show up as junk text).
Most likely you have some text in your script before the call to Graph::Stroke(). If this texts gets sent back to the browser the browser will assume that all data is plain text. Look for any text, even spaces and newlines, that might have been sent back to the browser.
For example it is a common mistake to leave a blank line before the opening "<?php".
================================================================
Yé soui perdouuuuuuu!!!
J'ai cherché qqchose en rapport avec la derniere ligne (un blanc avant un <?php) mais non, rien...
Bon... Encore une galere...
Pour commencer, voici le code de ma page PHP qui doit afficher mon graphique...
[code]
<?php /* Date de création: 30/01/2008 */ ?>
<html>
<body background="/siteGSM/images/fond.jpg">
<?php
include ("C_GSM.php");
include ('jpgraph/jpgraph.php');
include ('jpgraph/jpgraph_line.php');
$ydata = array(8,3,16,2,7,25,16);
// Creation du graphique
$graph = new Graph(300,200);
$graph->SetScale("textlin");
// Création du système de points
$lineplot=new LinePlot($ydata);
// On rajoute les points au graphique
$graph->Add($lineplot);
// Affichage
$graph->Stroke();
?>
<DIV CLASS="page">
<CENTER>
<!-- vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv -->
<IMG SRC="courbe-d1.php?values=0.0;10.0;20.01;30.0;40.0;50.0;45.0;40.88;35.71;20.72;15.16;9.05;4.26;1.58;0.25;0.0;0.0;0.0;">
<IMG SRC="courbe-d2.php?values=0.0;100.0;90.01;80.0;70.0;60.0;50.0;20.88;18.71;16.72;15.16;9.05;4.26;1.58;0.25;0.0;0.0;0.0;">
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -->
</CENTER>
<BR><BR><BR>
</DIV>
</body>
</html>
[/code]
Mais seulement, voila ce que mon navigateur me retourne
================================================================
JpGraph Error: HTTP headers have already been sent.
Caused by output from file CRCourbe.php at line 4.
Explanation:
HTTP headers have already been sent back to the browser indicating the data as text before the library got a chance to send it's image HTTP header to this browser. This makes it impossible for the library to send back image data to the browser (since that would be interpretated as text by the browser and show up as junk text).
Most likely you have some text in your script before the call to Graph::Stroke(). If this texts gets sent back to the browser the browser will assume that all data is plain text. Look for any text, even spaces and newlines, that might have been sent back to the browser.
For example it is a common mistake to leave a blank line before the opening "<?php".
================================================================
Yé soui perdouuuuuuu!!! :shock:
J'ai cherché qqchose en rapport avec la derniere ligne (un blanc avant un <?php) mais non, rien...