我正在尝试从 CakePHP 中的 PHP 变量中删除引号。我试过trim()
, substr()
, ereg_replace()
, and str_replace()
,但没有任何影响引号。当我substr
这样使用时:
substr($comma_separated, 1, -1);
它删除第一个和最后一个字母,但不删除引号。字符串是
$comma_separated = "makamo66@hotmail.com','makamo66@gmail.com"
这是 CakeEmail 的无效电子邮件地址。我也试过
$comma_separated = ereg_replace('"', "", $comma_separated);
和
$comma_separated = str_replace('"', '', $comma_separated);
我说的不够具体。这是我要删除的双引号。不是单身的。
我已经尝试了所有这些,它们看起来像正常的引号 $comma_separated = ereg_replace('"', "", $comma_separated); //输出没有变化 $comma_separated = str_replace('"', '', $comma_separated ); //输出没有变化 $comma_separated = substr($comma_separated,1,-1); //输出删除的最后一个和第一个字母 $comma_separated = trim($comma_separated,'"'); //输出没有变化