Home >Backend Development >PHP Tutorial > post参数的值为一段路径,传到后端时反斜杠都被过滤掉,这个有关问题如何解决

post参数的值为一段路径,传到后端时反斜杠都被过滤掉,这个有关问题如何解决

WBOY
WBOYOriginal
2016-06-13 13:27:301874browse

post参数的值为一段路径,传到后端时反斜杠都被过滤掉,这个问题怎么解决?
请教rt,代码如下
$.post("http://localhost/gl/index.php?imgUrl=glc/modules/mod_glc_results/assets/js/flashupload/saved/image/2012061402012-06-14-15-33-34_87618_thumb.jpg").done(function(){});

在后端php中$_post["imgUrl"]获取到的则是没有反斜杠的字符串:glcmodulesmod_glc_resultsassetsjsflashuploadsavedimage2012061402012-06-14-15-33-34_87618_thumb.jpg

请教前辈们我缺哪些知识需要学习来解决这个问题?(另:用特殊字符替代反斜杠的方法已近试验过,行不通)

------解决方案--------------------

探讨

你在JS端把glc/modules/mod_glc_results/assets/js/flashupload/saved/image/2012061402012-06-14-15-33-34_87618_thumb.jpg进行Urlencode,否则就被当做pathinfo了。
Statement:
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