我有一个表单处理这样的文字:
$group_description = mysql_real_escape_string(trim($_POST['group_description']));
$insert_group_sql = 'INSERT INTO table_name( group_description )
VALUES ( "'.$group_description.'" ') ';
另一个输出db结果的页面如下:
$group_description = $row['group_description'];
//Convert all urls to links
$group_description = preg_replace('#([\s|^])(www)#i', '$1http://$2', $group_description);
$pattern = '#((http|https|ftp|telnet|news|gopher|file|wais):\/\/[^\s]+)#i';
$replacement = '<a href="$1" target="_blank">$1</a>';
$group_description = preg_replace($pattern, $replacement, $group_description);
$group_description = str_replace(array('\r\n', '\n\r'), '<br />',$group_description);
/* Convert all E-mail matches to appropriate HTML links */
$pattern = '#([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.';
$pattern .= '[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)#i';
$replacement = '<a href="mailto:\\1">\\1</a>';
$group_description = preg_replace($pattern, $replacement, $group_description);
我最终得到的是此页:http://www.comehike.com/hikes/hiking_group.php?hiking_group_id=54
而且我不太确定这个用户如何得到\\ r \ n个字符进入那里:)
知道出了什么问题吗?如果这很重要,我会使用MySQL数据库。谢谢!