©
Ce document utilise Manuel du site Web PHP chinois Libérer
(PHP 5 >= 5.1.0)
Exception thrown if a callback refers to an undefined function or if some arguments are missing.
[#1] Gilles A [2014-05-09 07:58:19]
For example :
<?php
class Image
{
public function __construct()
{
if (!extension_loaded('gd'))
{
throw new BadFunctionCallException('GD extension is not loaded.');
}
}
}
?>
[#2] Dawid Krysiak [2011-02-03 02:35:55]
Direct known subclasses:
BadMethodCallException
So BadMethodCallException can be used in case the subject function is or should be a part of class / object - it's use defines the case more precisely.
[#3] tom at tomwardrop dot com [2009-11-15 19:42:38]
A typical use for this exception, is in conjunction with the is_callable() function.