问题
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