get_magic_quotes_gpc()不能用怎么处理

WBOY
Release: 2016-06-13 13:21:54
Original
8935 people have browsed it

get_magic_quotes_gpc()不能用怎么办
刚学php三天,希望高手们多多指教,谢谢哈
我用的编译软件是php5.4 。我在我的程序中使用了echo get_magic_quotes_gpc()函数来判断环境,从而决定输入数据库的信息是否需要设置转码。代码写好后在编译软件上没有显示错误,但是我打开浏览器却显示Deprecated: Function get_magic_quotes_gpc() is deprecated in.....。 于是我写了个测试用的语句echo get_magic_quotes_gpc();结果在浏览器上还是如此。
请问这种问题怎么解决,或者还有没有其它的方法来判断输入数据库的信息是否需要转码? 


------解决方案--------------------
这个函数已经抛弃了,所以也就不需要再使用了.
可以使用addslashes()对提交的变量进行过滤.
------解决方案--------------------
到了php5.4 已经移除了这个功能。你直接用mysql_real_escape_string() 或者 addslashes 进行转义。

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!