예를 들어, $_GET
에서 403
과 같은 값을 받고 있습니다. 메일을 보내고 있습니다. 하지만 나는 403에 반환하면 메일에 sent
을 반환합니다 싶습니다.문자열로 전환하십시오.
<?php
require_once 'vendor/autoload.php';
switch($_GET['status'])
{
case 403:
echo 'sent';
break;
}
switch($_GET['status'])
{
case 404:
echo 'delivered';
break;
}
if (!empty($_GET['MsgId'])) {
$transport = (new Swift_SmtpTransport('xxx', xxx))
->setUsername('xxx')
->setPassword('xxx');
$mailer = new Swift_Mailer($transport);
$message = (new Swift_Message('Status SMS ' . $_GET['MsgId'] . '.'))
->setFrom(['xxx' => 'xxx'])
->setTo(['xxx' => 'xxx', 'xxx' => 'xxx'])
->setBody("ID Wiadomości : " . $_GET['MsgId'] . "Status Wiadomości" . $_GET['status'] . ".");
$result = $mailer->send($message);
echo 'OK';
}
else {
echo 'Coś nie śmigło.';
}
exit;
스위치가 작동하지 않습니다.
스위치가 작동하는 방식이 아닙니다. – teeyo
'switch' 문을'if' 문처럼 사용하고 있습니다. – Dimi