如何输出带双引号的字符串? [英] How to output a string with a double quotation mark?
本文介绍了如何输出带双引号的字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要输出一个字符串,基本上是一个java代码:
I need to output a string, which is basically a java code:
我有这样的事情:
$web = "...if (url.contains('.mp4'))..."
我需要单引号,将是双引号,而不是在 html 代码中.
I need that the single quotation mark, will be a double one, and not in html code.
可以吗?
推荐答案
$new_str = str_replace('\'', '"', $web);
您可以通过修改实际字符串来选择执行此操作(注意使用 \
来转义引号):
You could optional do it by modifying the actual string (note the use of \
to escape the quotation marks):
$web = "...if (url.contains(\".mp4\"))..."
这篇关于如何输出带双引号的字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文