How can i escape double quotes from a string in php?

久未见 提交于 2019-12-12 04:57:25

问题


I've been trying to solve this but no luck. This is my code.

       $replace1 =str_replace('hreflang=\"'.$arr['variantslang1hid'].'\"     lang=\"'.$arr['variantslang1hid'].'\"','hreflang=\"'.$arr['variantslang1'].'\" lang=\"'.$arr['variantslang1'].'\"',$replace1);

It should replace but no. I'm not escaping "" properly. How can i solve this? Help much appreciated!


回答1:


if you use single quotes, you don't need to escape double quotes, '"' is what you want.



来源:https://stackoverflow.com/questions/9389191/how-can-i-escape-double-quotes-from-a-string-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!