how to replace a string in php
我想替换 \\'<\\’ 和 \\’>\\’ 登录字符串。
例如
1
2 3 |
这给出以下结果
1
|
if xsomethingy and y>z
|
我的问题是如何将 \\’>\\’ 替换为文本 \\’something\\’
1
|
有可能,见手册
- 我应该如何将 \\’>\\’ 替换为其他文本而不是具体 \\’something\\’
- 和 \\'<\\’ 应该替换为 \\’something\\’
- 感谢 RC 我已经通过使用 str_replace(array(\\'<\\’,\\’>\\’),array(\\’
签出preg_replace()
文档在这里 http://php.net/manual/en/function.preg-replace.php
例子是
preg_replace(‘/[<>]/’, ‘something’, $str);
preg_replace(/[<>]/g, ‘something’, $str)
你需要学习一些 PHP 呀
http://php.net/manual/en/function.preg-replace.php
来源:https://www.codenong.com/4283044/