在我的第一个.php文件中,我有:
session_start();
$_SESSION['ProdType1'] = $_GET['ProdType'];
echo "session Product type = " . $_SESSION['ProdType1'];
require_once("./include/fgcontactform.php");
$_SESSION['ProdType1']
设置正确。
在fgcontactform.php
我有以下内容:
echo "Prod typefg = " . $_SESSION['ProdType1'];
$_SESSION['ProdType1']
设置正确。
class FGContactForm
{
function ExtraInfoToMail()
{
$ret_str='';
//echo "Prod type in func = " . $_SESSION['ProdType1'];
$ip = $_SERVER['REMOTE_ADDR'];
$p1 = $_SESSION['ProdType1'];
$ret_str = "<div class='label'>IP address of the submitter: </div><div class='value'>$ip</div>\n";
$ret_str .= "<div class='label'>Product Type: </div><divclass='value'>$p1</div>\n";
return $ret_str;
}
$p1
为空,$_SESSION['ProdType1']
也是。
任何帮助都会很棒。