手册:全域对象变量

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Manual:Global object variables and the translation is 14% complete.

Other languages:
Deutsch • ‎English • ‎español • ‎italiano • ‎polski • ‎português do Brasil • ‎русский • ‎中文 • ‎日本語

Hundreds of globals are initialized on startup by MediaWiki. The majority of these global variables are configuration settings that are set in DefaultSettings.php and LocalSettings.php . (See Manual:Configuration settings for documentation on these variables.) There is no comprehensive documentation for the remaining few hundred globals, however, some of the most important ones are listed below. They are typically initialized either in index.php or in Setup.php .

全域变量

  • $mediaWiki - MediaWiki object, the main base class for the MediaWiki software. Initializes the $wgTitle and $wgArticle objects, and executes the URL actions.
  • $wgArticle - Article object corresponding to $wgTitle.
  • $wgContLang - Language object associated with the wiki being viewed.
  • $wgLang - Language object selected by user preferences.
  • $wgLoadBalancer - LoadBalancer object, manages database connections. (在1.13版本中已移除)
  • $wgMessageCache - Message cache to manage interface messages.
  • $wgOut - OutputPage object for HTTP response.
  • $wgParser - Parser object. Parser extensions register their hooks here.
  • $wgRequest - WebRequest object, to get request data.
  • $wgTitle - Title object created from the request URL. 注意 注意: This variable should be avoided when possible, more sane title objects are usually available.
  • $wgUser - User object for the user associated with the current request.

参见