从php表单中删除字符

从php表单中删除字符,php,forms,Php,Forms,我试图从php表单中删除某些字符和关键字,但运气不太好。 我想要的是一个模块化的过滤器列表,以删除URL和某些关键字。目前,我只想删除http链接,同时保留允许的域。在本例中,example.com <?php //Check whether the form has been submitted if (array_key_exists('check_submit', $_POST)) { //Converts the new line characters (\n) in t

我试图从php表单中删除某些字符和关键字,但运气不太好。
我想要的是一个模块化的过滤器列表,以删除URL和某些关键字。目前,我只想删除http链接,同时保留允许的域。在本例中,example.com

<?php //Check whether the form has been submitted
 if (array_key_exists('check_submit', $_POST)) {    
//Converts the new line characters (\n) in the text area into HTML line breaks (the <br /> tag)    
$_POST['Comments'] = nl2br($_POST['Comments']);     //Check whether a 
$_GET['Languages'] is set    
}

   //Let's now print out the received values in the browser   
 echo "<br />{$_POST['Comments']}<br /><br />"; 
} 
else 
{
    echo "You can't see this page without submitting the form."; 
} 
?>
我总是使用:

$data = "<b> some text ///, test</b>"    
htmlentities(strip_tags(mysql_real_escape_string($data)));
$data=“一些文本//,测试”
htmlentities(strip_标签(mysql_real_escape_string($data)));

希望有帮助

你试过什么?你看过了吗?试过了,但不知道如何正确地实现它。研究正则表达式,这是最简单的方法。多亏对它进行了排序,我真的需要重新学习php。我写了一个正则表达式,可以帮助你入门:
http:\/\/(example.com;google.com)。+