我的数据库中有一列包含文本字符串,例如Tablet with 7" Screen and 3" stylus
。当我使用PHP获取此数据时(通过Laravel Eloquent模型,更具体),该字符串将有额外的引号 - 它将显示为"Tablet with 7"" Screen and 3"" stylus"
。这也是var_dump()
中输出的方式。
如何轻松剥离这些无关的引号?我调查了stripslashes()
和stripcslashes()
,但那些似乎并没有完成这项工作。不确定这是否存在MySQL存储数据的问题,或者我是否缺少某种功能,这样可以使这更容易。
答案 0 :(得分:0)
从字符串
中删除双引号$str = "Tablet with 7\" Screen and 3\" stylus";
$str = str_replace("\"", "", $str);