求大神帮写一个PHP的正则表达式。 10
展开全部
$_POST是转义了的需要stripslashes一下,把下边的存为preg.php然后跑一下看看就明了了
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Post_stripslashes</title>
</head>
<body>
<?
if($_POST[preg]){
echo "<xmp>".$_POST[preg]."</xmp><br />";
echo "<xmp>".stripslashes($_POST[preg])."</xmp>";
}
?>
<form action="preg.php" method="post">
<input type="text" name="preg" value='/<\/a>\] <a href=\"\s*(.+?)\">/is' /><input value="do" type="submit" />
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Post_stripslashes</title>
</head>
<body>
<?
if($_POST[preg]){
echo "<xmp>".$_POST[preg]."</xmp><br />";
echo "<xmp>".stripslashes($_POST[preg])."</xmp>";
}
?>
<form action="preg.php" method="post">
<input type="text" name="preg" value='/<\/a>\] <a href=\"\s*(.+?)\">/is' /><input value="do" type="submit" />
</form>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询