PHP: Como usar strstr em switch case
Não sabe para que serve strstr? Puxa vida! Clique aqui urgente!
$x = "HTTP/1.0 200 OK Content-type: text/html Expires: Tue, 01 Jan 1980 1:00:00 GMT Cache-Control: no-cache Message Submitted MessageID=499DBC2D.req, Recipient=+65933xxx"; switch (true) { case strstr ($x, "MessageID="): $msg = "Aviso! Mensagem enviada com sucesso."; $status = "OK"; break; case strstr ($x, "Error:"): $msg = "Aviso! Ocorreu um erro com o servidor ao enviar sua mensagem."; $status = "NOTOK"; break; case strstr ($x, "Invalid username and password"): $msg = "Aviso! Usuário ou senha informado não são válidos."; $status = "NOTOK"; break; } if($status == "OK") { echo "<p style='color:green'>$msg</p>"; }else{ echo "<p style='color:red'>$msg</p>"; } |
Até +