0

I have my web site in html, with php chunks embedded. I define some variables in the main page as

<?php
$GLOBALS['myVar']= "something";
?>

later I have

<?php
echo '<p align="center"><img src="./tempImg.php">';
?>

the tempImg php file displays, using the phplot.php lib, a dynamic plot of some data read from the database and in the tempImg.php file I must use the myVar variable. I tried using the GLOBALS[], the _SESSION[] but I am not able to share the variable in this way.

thanks for any help

4

1 回答 1

0
$GLOBALS['myVar']= "something";
echo '<p align="center"><img src="./tempImg.php?myVar=' . $GLOBALS['myVar'] . '">';

要不就:

$myVar = "something";
echo '<p align="center"><img src="./tempImg.php?myVar=' . $myVar . '">';

然后$_GET['myVar']进入tempImg.php.

于 2013-11-14T19:26:59.757 回答