php--得到我们开始使用php前的一些参数:变量 / 常量 / 模块 / 函数 / 类

1,array get_defined_vars ( void ) 获取由所有已定义变量所组成的数组(包括环境变量、服务器变量和用户定义的变量。)

2,array get_defined_functions ( void ) 获取所有已经定义的函数

3,array get_loaded_extensions ([ bool $zend_extensions = false ] ) 返回了 PHP 解析器里所有编译并加载的模块名。

参数默认是false,返回(普通扩展和zend扩展),true时只返回zend扩展。

4,array get_extension_funcs ( string $module_name ) 返回指定模块所有可用的函数

5,array get_defined_constants ([ bool $categorize = false ] ) 返回所有常量的关联数组,键是常量名,值是常量值

6,array  get_declared_classes ( void ) 获取由已定义类的名字所组成的数组

7,get_included_files() / get_require_files() 返回所有被 include、 include_once、 require 和 require_once 的文件名,组成数组,第一个是本文件名。

看一下,discuz!3.x的forum.php载入了多少文件:

Array
(
    [0] => D:\webserver\www\Discuz_X3.1\forum.php
    [1] => D:\webserver\www\Discuz_X3.1\source\class\class_core.php
    [2] => D:\webserver\www\Discuz_X3.1\source\class\discuz\discuz_application.php
    [3] => D:\webserver\www\Discuz_X3.1\source\class\discuz\discuz_base.php
    [4] => D:\webserver\www\Discuz_X3.1\source\function\function_core.php
    [5] => D:\webserver\www\Discuz_X3.1\config\config_global.php
    [6] => D:\webserver\www\Discuz_X3.1\source\class\discuz\discuz_database.php
    [7] => D:\webserver\www\Discuz_X3.1\source\function\function_forum.php
    [8] => D:\webserver\www\Discuz_X3.1\source\class\db\db_driver_mysql.php
    [9] => D:\webserver\www\Discuz_X3.1\source\class\table\table_common_syscache.php
    [10] => D:\webserver\www\Discuz_X3.1\source\class\discuz\discuz_table.php
    [11] => D:\webserver\www\Discuz_X3.1\source\class\discuz\discuz_memory.php
    [12] => D:\webserver\www\Discuz_X3.1\source\class\table\table_common_member.php
    [13] => D:\webserver\www\Discuz_X3.1\source\class\discuz\discuz_table_archive.php
    [14] => D:\webserver\www\Discuz_X3.1\source\class\discuz\discuz_session.php
    [15] => D:\webserver\www\Discuz_X3.1\source\class\table\table_common_session.php
    [16] => D:\webserver\www\Discuz_X3.1\source\class\discuz\discuz_cron.php
    [17] => D:\webserver\www\Discuz_X3.1\source\class\table\table_common_cron.php
    [18] => D:\webserver\www\Discuz_X3.1\source\class\discuz\discuz_process.php
    [19] => D:\webserver\www\Discuz_X3.1\source\class\table\table_common_process.php
    [20] => D:\webserver\www\Discuz_X3.1\source\include\cron\cron_follow_daily.php
    [21] => D:\webserver\www\Discuz_X3.1\source\class\table\table_home_follow_feed.php
    [22] => D:\webserver\www\Discuz_X3.1\source\class\helper\helper_util.php
    [23] => D:\webserver\www\Discuz_X3.1\source\language\lang_core.php
    [24] => D:\webserver\www\Discuz_X3.1\source\plugin\mobile\mobile.class.php
)
载入了这么多还真吓人。


总结,php在我们使用之前已经有这么多参数,有点小惊讶,特别是有一百多个类:

Array
(
    [0] => stdClass
    [1] => Exception
    [2] => ErrorException
    [3] => COMPersistHelper
    [4] => com_exception
    [5] => com_safearray_proxy
    [6] => variant
    [7] => com
    [8] => dotnet
    [9] => ReflectionException
    [10] => Reflection
    [11] => ReflectionFunctionAbstract
    [12] => ReflectionFunction
    [13] => ReflectionParameter
    [14] => ReflectionMethod
    [15] => ReflectionClass
    [16] => ReflectionObject
    [17] => ReflectionProperty
    [18] => ReflectionExtension
    [19] => DateTime
    [20] => DateTimeZone
    [21] => LibXMLError
    [22] => __PHP_Incomplete_Class
    [23] => php_user_filter
    [24] => Directory
    [25] => SimpleXMLElement
    [26] => DOMException
    [27] => DOMStringList
    [28] => DOMNameList
    [29] => DOMImplementationList
    [30] => DOMImplementationSource
    [31] => DOMImplementation
    [32] => DOMNode
    [33] => DOMNameSpaceNode
    [34] => DOMDocumentFragment
    [35] => DOMDocument
    [36] => DOMNodeList
    [37] => DOMNamedNodeMap
    [38] => DOMCharacterData
    [39] => DOMAttr
    [40] => DOMElement
    [41] => DOMText
    [42] => DOMComment
    [43] => DOMTypeinfo
    [44] => DOMUserDataHandler
    [45] => DOMDomError
    [46] => DOMErrorHandler
    [47] => DOMLocator
    [48] => DOMConfiguration
    [49] => DOMCdataSection
    [50] => DOMDocumentType
    [51] => DOMNotation
    [52] => DOMEntity
    [53] => DOMEntityReference
    [54] => DOMProcessingInstruction
    [55] => DOMStringExtend
    [56] => DOMXPath
    [57] => RecursiveIteratorIterator
    [58] => IteratorIterator
    [59] => FilterIterator
    [60] => RecursiveFilterIterator
    [61] => ParentIterator
    [62] => LimitIterator
    [63] => CachingIterator
    [64] => RecursiveCachingIterator
    [65] => NoRewindIterator
    [66] => AppendIterator
    [67] => InfiniteIterator
    [68] => RegexIterator
    [69] => RecursiveRegexIterator
    [70] => EmptyIterator
    [71] => ArrayObject
    [72] => ArrayIterator
    [73] => RecursiveArrayIterator
    [74] => SplFileInfo
    [75] => DirectoryIterator
    [76] => RecursiveDirectoryIterator
    [77] => SplFileObject
    [78] => SplTempFileObject
    [79] => SimpleXMLIterator
    [80] => LogicException
    [81] => BadFunctionCallException
    [82] => BadMethodCallException
    [83] => DomainException
    [84] => InvalidArgumentException
    [85] => LengthException
    [86] => OutOfRangeException
    [87] => RuntimeException
    [88] => OutOfBoundsException
    [89] => OverflowException
    [90] => RangeException
    [91] => UnderflowException
    [92] => UnexpectedValueException
    [93] => SplObjectStorage
    [94] => XMLReader
    [95] => XMLWriter
    [96] => mysqli_sql_exception
    [97] => mysqli_driver
    [98] => mysqli
    [99] => mysqli_warning
    [100] => mysqli_result
    [101] => mysqli_stmt
    [102] => PDOException
    [103] => PDO
    [104] => PDOStatement
    [105] => PDORow
)


php--得到我们开始使用php前的一些参数:变量 / 常量 / 模块 / 函数 / 类,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。