Manual:$wgUser/zh

详情
The User object encapsulates the state of the user viewing/using the site. The User object can be queried for things like the user's settings, name, etc. It handles the details of getting and saving to the "user" table of the database, and dealing with sessions and cookies.

Client classes use the  functions to access these fields. These functions do all the work of determining whether the user is logged in, whether the requested option can be satisfied from cookies or whether a database query is needed. Most of the settings needed for rendering normal pages are set in the session to minimize use of the database.

is initialized towards the end of setup. Some hooks are called earlier than that and should avoid using it. When in doubt use  to check (you can always rely on it being a   object, but it will not refer to the right user when trying to access it early).