我可以使用以下代码创建变量分配:
ts.createVariableStatement(undefined,
[ts.createVariableDeclaration('a', undefined,
ts.createStringLiteral('42'))])
/// yields: var a = 42
但是我不能创建一个const赋值。我很确定它应该像这样工作:
ts.createVariableStatement([ts.createModifier(ts.SyntaxKind.ConstKeyword)],
[ts.createVariableDeclaration('a', undefined,
ts.createStringLiteral('42'))])
但这会产生错误:
[!] Error: Unexpected keyword 'var'
由于该错误,未发出JavaScript。错误消息也非常令人困惑。
答案 0 :(得分:2)
尝试一下:
if (!$stm)
{
echo "";
}
else
{
$last_email = null;
while ($rows = $stm->fetch())
{
$CPersonUId = isset($rows['PersonUId']) ? $rows['PersonUId'] : NULL;
$CType = isset($rows['CardType']) ? $rows['CardType'] : NULL;
$CNr = isset($rows['CardNr']) ? $rows['CardNr'] : NULL;
$CValFrom = isset($rows['ValidFrom']) ? $rows['ValidFrom'] : NULL;
$CValUntil = isset($rows['ValidUntil']) ? $rows['ValidUntil'] : NULL;
$CLTCCTime = isset($rows['LastTccTime']) ? $rows['LastTccTime'] : NULL;
$CLTPEmail = isset($rows['Email']) ? $rows['Email'] : NULL;
if ($CValUntil != NULL)
{
$time1 = strtotime($CValUntil);
$mytime1 = date("d/m/Y", $time1);
$CValUntil = $mytime1;
}else{
$mytime1 = $CValUntil;
}
if($CType == 6){
$CType = 'Type 1';
}elseif($CType == 5){
$CType = 'Type 2';
}elseif($CType == 1){
$CType = 'Type 3';
}
$message = '<html><body>';
$message .= "<p>Cartão nº<b>".$CNr."</b> válido até <b>".$mytime1." Tipo: ".$CType."</b></p>";
$message .= '</body></html>';
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->Host = "test-localhost";
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Port = "465";
$mail->Username = "admin@gmail.com";
$mail->Password = "passxxxxx";
$mail->SetFrom('admin@gmail.com', 'admin');
$mail->addReplyTo("admin@gmail.com");
$mail->Subject = "Subject";
$mail->AltBody = "Alt";
$mail->MsgHTML($message);
if ( $last_email == null ) {
$last_email = $CLTPEmail;
}
if ( $CLTPEmail != $last_email ) {
//echo $last_email . "</br>";
$mail->addAddress($last_email);
if(!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
$last_email = $CLTPEmail;
}
}
echo $last_email."</br>";
}
基于this answer。