博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
判断函数是否存在
阅读量:7163 次
发布时间:2019-06-29

本文共 220 字,大约阅读时间需要 1 分钟。

hot3.png

当我们创建了自定义函数,并且了解了可变函数的用法,为了确保程序调用的函数是存在的,经常会先使用function_exists判断一下函数是否存在。同样的method_exists可以用来检测类的方法是否存在。

function func() {}if (function_exists('func')){    echo 'exists';}

转载于:https://my.oschina.net/u/2395167/blog/547243

你可能感兴趣的文章