PHP:倒车mysql_real_escape_string的二元效应 [英] php: reversing mysql_real_escape_string's effects on binary

查看:134
本文介绍了PHP:倒车mysql_real_escape_string的二元效应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建了一个网页,用户可以提交一个PDF,然后插入到一个MySQL数据库在MEDIUMBLOB检索更高版本。

I built a webpage where users can submit a PDF which is then inserted into a MySQL database in a mediumblob for retrieval later.

这一切工作正常,当PDF包含图像或嵌入字体,在这种情况下,图像被损坏,使用字体的文本消失(Acrobat中显示关于缺少的字体消息)。除了

This all works fine, except when the PDF contains images or embedded fonts, in which case the images are corrupted and any text using the font disappears (Acrobat display a message about the missing font).

我决定从我通过mysql_real_escape_string_function传递PDF数据出现问题。我已经切换到base64_en在提交/检索它解决了这一问题对所有的新文件code / base64_de code,但我有大约25已经提交PDF文件,我需要能够读取。

I've determined the problem occurs from my passing the pdf data through the mysql_real_escape_string_function. I have switched to base64_encode/base64_decode on submission/retrieval which fixed the problem for all new files, but I have about 25 already submitted PDFs I need to be able to read.

是否有可能mysql_real_escape_string逆转的影响?或者,这些文件无法修复的损坏?

Is it possible to reversed the effects of mysql_real_escape_string? Or are these files damaged beyond repair?

推荐答案

mysql_real_escape_string()把反斜杠这些字符。

\x00, \n, \r, \, ', " and \x1a

问题是,如果你的二进制输出具有反斜线它,它的二进制数据,它可以是非常难以解决。话虽这么说,没有神奇功能撤消此功能。

The thing is, that if your binary output has backslashes it it's binary data, it can be very hard to fix. That being said, there is no magical function to undo this function.

这篇关于PHP:倒车mysql_real_escape_string的二元效应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆