PHP反转义问题

WBOY
Release: 2016-06-23 14:08:20
Original
1171 people have browsed it

$file="d:\1\2.pdf";

请问有什么方法,代码方法可以反转义,就是让\不起作用,否则运行之后就是错误的。


回复讨论(解决方案)

addslashes() 

addslashes() 

经测试不起作用。
$file="d:\1.pdf";
$newFile=addslashes($file);

echo之后是d:.pdf

$newFile=htmlspecialchars('d:\1.pdf');
echo $newFile;

$file = 'd:\1\2.pdf';

用双引号的话需写作
$file = "d:\\1\\2.pdf";

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template