Is the PHP method available?
You can use the function function_exists() to check if a PHP method exists. It will return true if the method exists, otherwise it will return false.
For example, the following code snippet demonstrates how to use function_exists() to check if a method named myFunction exists:
if (function_exists('myFunction')) {
echo "myFunction 存在";
} else {
echo "myFunction 不存在";
}
In the above code, if myFunction exists, output “myFunction exists”; otherwise, output “myFunction does not exist”.