怎么判断实例的方法已经过时

WBOY
Release: 2016-06-13 12:19:34
Original
1026 people have browsed it

如何判断实例的方法已经过时?
最近写代码遇到过一个这样的错误:

<br />PHP Deprecated: Function MongoDB::authenticate() is deprecated <br />
Copy after login

说authenticate这个方法已经过时,请问我执行这方法之前如何判断一下?
谢谢!
------解决思路----------------------
Deprecated 已过时
但只是说:在不远的将来,这个方法会废除。但现在还是能用的

如果你不愿换用替代方法,那么可屏蔽掉该错误
------解决思路----------------------
这个跟版本有关系,显示Deprecated的,最好使用官方提供的新方法。因为以后的版本有可能会废弃以前的写法。
可以用版本来判断。

例如:
if(PHP_VERSION > xxx){
....
}else{
....
}

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!