我正在尝试将会话变量传递给变量' var'我是新手,请帮我解决下面第7行代码中的问题。
PHP
if($user){
$response["error"] = false;
$_SESSION['vault_no'] = $user['vault_no'];
$to=$email;
$subject = "Reset profile password";
$txt = "Click on link to reset your profile password-> www.miisky.com/appmiisky/reset_pro.php?var = $_SESSION['vault_no']" ;
$headers = 'From: innovation@miisky.com' . "\r\n" ;
$headers .= "BCC: prajwalkm7@gmail.com\r\n";
$headers .= 'Reply-To: innovation@miisky.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
/*$headers = 'From: innovation@miisky.com' . "\r\n" .
'Cc: innovation@miisky.com' . "\r\n" .
'Reply-To: innovation@miisky.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();*/
mail($to,$subject,$txt,$headers);
echo json_encode($response);
}
答案 0 :(得分:0)
双引号(")中的所有文本都被视为字符串
$txt = "Click on link to reset your profile password-> www.miisky.com/appmiisky/reset_pro.php?var = $_SESSION['vault_no']" ;
您需要使用字符串联系您的会话值以获取网址
$txt = "Click on link to reset your profile password-> www.miisky.com/appmiisky/reset_pro.php?var=" . $_SESSION['vault_no'];