php字符串替换引号 [英] php string replace quotes
本文介绍了php字符串替换引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我正在尝试使用 php str_replace 将所有单引号变为双引号,但是无论我做什么,它似乎都不起作用,建议
Hello I am trying to get all single quotes to be double quotes using the php str_replace however it does not seem to be working no matter what I do, suggestions
$page = str_replace("/'/", '/"/', $page);
推荐答案
更新:我同意其他人的看法,以下是大多数人更易于阅读的替代方案:
Update: I'd agree with others that the following is an easier-to-read alternative for most folks:
$page = str_replace("'", '"', $page);
我原来的回答:
$page = str_replace(chr(39), chr(34), $page);
这篇关于php字符串替换引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文