如何在邮寄前清理PHP中的用户输入?
我有一个简单的PHP邮件脚本,它从通过POST提交的表单中获取值并将其邮寄给我:
<?php
$to = "me@example.com";
$name = $_POST['name'];
$message = $_POST['message'];
$email = $_POST['email'];
$body = "Person $name submitted a message: $message";
$subject = "A message has been submitted";
$headers = 'From: ' . $email;
mail($to, $subject, $body, $headers);
header("Location: http://example.com/thanks");
?>
如何清理输入?