PHP 函数 is_subclass_of() PHP 函数 is_a() PHP 函数 method_exists() PHP 函数 is_subclass_of() <?php // define a class class wid_fact { var $oink = 'moo'; } // define a child class class wid_fact_child extends wid_fact { var $oink = 'oink'; } // create a new object $WF = new wid_fact(); $WFC = new wid_fact_child(); if (is_subclass_of($WFC, 'wid_fact')) { echo "yes, \$WFC is a subclass of wid_fact \n"; }else { echo "no, \$WFC is not a subclass of wid_fact \n"; } if (is_subclass_of($WF, 'wid_fact')) { echo "yes, \$WF is a subclass of wid_fact \n"; }else { echo "no, \$WF is not a subclass of wid_fact \n"; } ?> PHP 函数 is_a() PHP 函数 method_exists()