dswqw66280 2014-07-18 23:11
浏览 50
已采纳

查询MySQL数据库时,“Unescaping”在PHP中引用了字符串

I have a column in my database which contains text strings such as Tablet with 7" Screen and 3" stylus, for example. When I get this data using PHP (through a Laravel Eloquent model, to be more specific), the string will have extra quotes--it will be presented as "Tablet with 7"" Screen and 3"" stylus". This is also how it is outputted in a var_dump().

How can I strip these extraneous quotation marks easily? I looked into stripslashes() and stripcslashes() but those didn't seem to do the job. Not sure if this is an issue with how MySQL is storing the data, or if there's some sort of function I'm missing that'll make this easier.

  • 写回答

1条回答 默认 最新

  • douqie1884 2014-07-18 23:17
    关注

    To remove the double-quote from a string

    $str = "Tablet with 7\" Screen and 3\" stylus";
    $str = str_replace("\"", "", $str);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题