我想替换'<'和'>'登录字符串。 如如何替换php中的字符串
$str = 'if x<y and y>z'; echo str_replace('<', 'something', $str) . "\n";
此给出的结果
if xsomethingy and y>z
我的问题是我怎么能代替 '>' 文本 '东西'
我想替换'<'和'>'登录字符串。 如如何替换php中的字符串
$str = 'if x<y and y>z'; echo str_replace('<', 'something', $str) . "\n";
此给出的结果
if xsomethingy and y>z
我的问题是我怎么能代替 '>' 文本 '东西'
preg_replace(/[<>]/g, 'something', $str)
你需要学习一些PHP呀
http://php.net/manual/en/function.preg-replace.php
退房preg_replace()
文档这里http://php.net/manual/en/function.preg-replace.php
例子是 preg_replace('/[<>]/', 'something', $str);
......用同样的方法? – 2010-11-26 06:42:03