2013-12-08 89 views
1

我有一个preg_replace函数的问题。用双斜杠preg_replace

如何替换文本: \\ \\文本到 : 文本

我的代码是:

preg_replace("/\\/(.*?)/\\/","<s>\\1</s>", "\\test\\") 

回答

0

我测试了这一点:

<?php 
$str1 = "\\test\\"; 
echo "<textarea style=\"width: 700px; height: 300px;\">" 
    . preg_replace('/\\\\([^\\\]+)\\\\/', "<s>\\1</s>", $str1) 
    . "</textarea>"; 
?> 
+0

感谢你非常许多! – Knowledge