ReflectionExtension::getClassNames()函數是PHP中的內置函數,用於從指定的擴展名返回類名數組。如果未指定任何類,則返回一個空數組。
用法:
array ReflectionExtension::getClassNames( void )
參數:該函數不接受任何參數。
返回值:該函數從指定的擴展名返回一個類名數組。
以下示例程序旨在說明PHP中的ReflectionExtension::getClassNames()函數:
程序_1:
<?php
// Defining an extension
$A = 'DOM';
// Using ReflectionExtension() over the
// specified extension
$extension = new ReflectionExtension($A);
// Calling the getClassNames() function
$B = $extension->getClassNames();
// Getting an array of class name
var_dump($B);
?>
輸出:
array(31) { [0]=> string(12) "DOMException" [1]=> string(13) "DOMStringList" [2]=> string(11) "DOMNameList" [3]=> string(21) "DOMImplementationList" [4]=> string(23) "DOMImplementationSource" [5]=> string(17) "DOMImplementation" [6]=> string(7) "DOMNode" [7]=> string(16) "DOMNameSpaceNode" [8]=> string(19) "DOMDocumentFragment" [9]=> string(11) "DOMDocument" [10]=> string(11) "DOMNodeList" [11]=> string(15) "DOMNamedNodeMap" [12]=> string(16) "DOMCharacterData" [13]=> string(7) "DOMAttr" [14]=> string(10) "DOMElement" [15]=> string(7) "DOMText" [16]=> string(10) "DOMComment" [17]=> string(11) "DOMTypeinfo" [18]=> string(18) "DOMUserDataHandler" [19]=> string(11) "DOMDomError" [20]=> string(15) "DOMErrorHandler" [21]=> string(10) "DOMLocator" [22]=> string(16) "DOMConfiguration" [23]=> string(15) "DOMCdataSection" [24]=> string(15) "DOMDocumentType" [25]=> string(11) "DOMNotation" [26]=> string(9) "DOMEntity" [27]=> string(18) "DOMEntityReference" [28]=> string(24) "DOMProcessingInstruction" [29]=> string(15) "DOMStringExtend" [30]=> string(8) "DOMXPath" }
程序_2:
<?php
// Using ReflectionExtension() over
// a extension xml
$extension = new ReflectionExtension('xml');
// Calling the getClassNames() function and
// Getting an array of class names
var_dump($extension->getClassNames());
?>
輸出:
array(0) { }
參考: https://www.php.net/manual/en/reflectionextension.getclassnames.php
相關用法
- PHP ReflectionExtension getVersion()用法及代碼示例
- PHP ReflectionExtension info()用法及代碼示例
- PHP ReflectionExtension getConstants()用法及代碼示例
- PHP ReflectionExtension export()用法及代碼示例
- PHP ReflectionExtension getDependencies()用法及代碼示例
- PHP ReflectionExtension getClasses()用法及代碼示例
- PHP ReflectionExtension getFunctions()用法及代碼示例
- PHP ReflectionExtension getINIEntries()用法及代碼示例
- PHP ReflectionExtension isPersistent()用法及代碼示例
- PHP ReflectionExtension getName()用法及代碼示例
- PHP ReflectionExtension __toString()用法及代碼示例
- PHP ReflectionExtension isTemporary()用法及代碼示例
注:本文由純淨天空篩選整理自Kanchan_Ray大神的英文原創作品 PHP | ReflectionExtension getClassNames() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。