小编Ale*_*eza的帖子

用另一个引号(')str_replace替换单引号(')

我试图'用另一个quote()替换单引号(),但我似乎无法得到任何工作.另外,如何在多个字符串上进行此操作($text, $title, $notice)

输入:不要

输出:不要

我在尝试这个:

$text = str_replace(array("'",'"'), array('’'), $text);    
$text = htmlentities(str_replace(array('"', "'"), '’', $text);
$text = htmlentities(str_replace(array('"', "'"), '’', $_POST['text']));
$text = str_replace("'" ,"’",$text);
$text = str_replace("'" ,"’",$text);
$text = str_replace(array("'"), "’", $text);
$text = str_replace(array("\'", "'", """), "’", htmlspecialchars($text));
$text = str_replace(array('\'', '"'), '’', $text);
$text = str_replace(chr(39), chr(146), $text);
$text  = str_replace("'", "&ampquot;", $text); 
Run Code Online (Sandbox Code Playgroud)

这些都不起作用.

php string replace htmlspecialchars str-replace

-3
推荐指数
1
解决办法
790
查看次数

标签 统计

htmlspecialchars ×1

php ×1

replace ×1

str-replace ×1

string ×1