背景:我不是 php 程序员,我只知道让我的 iOS 应用程序的 Web 服务部分正常工作。
我发现我的 php 在我不想要的时候在我的文本中添加了反斜杠。例如,如果我设置一些这样的变量:
$directory = "directory/";
$file = "file.jpg"
然后我通过 JSON 数组输出回我的设备:
$directory . $file
我得到
"directory\/file.jpg"
我在我的 php 中运行了 get_magic_quotes_gpc ,它报告魔术引号已关闭。我这样做:
if (get_magic_quotes_gpc()){
//then I send something back in the JSON array to let me know that get_magic_quotes_gpc is on
}
我尝试使用 stripslashes() (在原始变量或输出上)并且没有任何变化。
那么我该如何阻止它这样做呢?因为这意味着我不能告诉我的 php 删除特定目录中的文件。
提前致谢