我試着去構造一個URL,如:
https://theserver/career/pathway?path=3&edu=4&cert=
這裏的首要問題是$message
變種正在失去的$pathval
值,$edval
,$certval
當填充到數組ALA $data
(如下所示)
當使用最後一個碼塊
else if ($action == "send") {
//added
#pathway var
var_dump($_SESSION);
$pathval = $_SESSION['pathid'];
$edval = $_SESSION['edid'];
$certval = $_SESSION['certid'];
var_dump($pathval);
var_dump($edval);
var_dump($certval);
$data = array(
"path"=>$pathval,
"edu"=>$edval,
"cert"=>$certval
);
var_dump($data);
$server_prefix = 'https://';
$server_address = $_SERVER['SERVER_ADDR'];
#$fullurl = $server_prefix.$server_address."/career/pathway?ed=".$edval;
// Send the email
$name = isset($_POST["name"]) ? $_POST["name"] : "";
$email = isset($_POST["email"]) ? $_POST["email"] : "";
$subject = isset($_POST["subject"]) ? $_POST["subject"] : $subject;
$message = $server_prefix.$server_address.'/career/pathway?'.http_build_query($data);
var_dump($message);
// $message = $pathval;
var_dump($message);
$cc = isset($_POST["cc"]) ? $_POST["cc"] : "";
$token = isset($_POST["token"]) ? $_POST["token"] : "";
// make sure the token matches
if ($token === smcf_token($to)) {
smcf_send($name, $email, $subject, $message, $cc);
echo "Your message was successfully sent.";
// echo $name . "\n";
// echo $email . "\n";
// echo $subject . "\n";
}
else {
echo "Unfortunately, your message could not be verified.";
}
}
個
此輸出(該電源輸出太棒了!):
array(3) { ["pathid"]=> string(1) "3" ["edid"]=> string(1) "4" ["certid"]=> string(0) "" } string(1) "3" string(1) "4" string(0) "" array(3) { ["path"]=> string(1) "3" ["edu"]=> string(1) "4" ["cert"]=> string(0) "" } string(56) "https://theserver/career/pathway?path=3&edu=4&cert=" string(56) "https://theserver/career/pathway?path=3&edu=4&cert=" Your message was successfully sen
電子郵件輸出爲:Message: https://theserver/career/pathway?path=edu=cert
你已經把'在session_start()? –
這真的很奇怪。你如何輸出這些字符串? –
是會話已創建,值是第一個「如果我嘗試」 – user2107529