php字符串转义像python的“”“ """ ;? [英] php string escaping like python's """ """?
问题描述
我想知道是否有一个简单的方法来逃避php中的字符串。
在python中我使用,并且之间的所有内容都被转义。所以当使用特殊字符时,它将被忽略。
我有一些文本可以回显,并手动转义一切都会永远。
$ b $ php有内置的类似函数吗?
谢谢!
你有哪些角色逃避?
您可以使用 单引号 [docs] 。在这样的字符串中必须转义的唯一字符是 \
和'
。
如果你有一个长字符串,还可以看一下 $ b。 $ b Hi I was wondering if there is an easy way to escape strings in php. In python I use """ """, and everything between there is escaped. so when using special characters it is ignored. I have some text to echo, and escaping everything manually just takes forever. Does php have a similar function built in ? thanks! Which are the characters do you have to escape? You could use single quotes [docs]. The only characters that have to be escaped in such a string are If you have a long string, also have a look at heredoc [docs]. 这篇关于php字符串转义像python的“”“ """ ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!\
and '
.