[英]Handling double slashes in a input string using php
I want to store an input with double slash and single slash in database.Also i need to show the original value while displaying. 我想在数据库中存储带有双斜杠和单斜杠的输入。此外,我还需要在显示时显示原始值。 ex: \\frhnt002\\sample-tr 例如:\\ frhnt002 \\ sample-tr
Anybody know how to do this in php? 有人知道如何在php中执行此操作吗?
Thanks 谢谢
You should escape a \\
with another backslash \\\\
. 您应该使用另一个反斜杠\\\\
转义一个\\
。
If you want to write two backslash in a string literal then you should write 4 backslash \\\\\\\\
. 如果要在字符串文字中写两个反斜杠,则应该写4个反斜杠\\\\\\\\
。
One backslash: \\\\
一个反斜杠: \\\\
Two backslash: \\\\\\\\
两个反斜杠: \\\\\\\\
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.