Manual:$wgAPIModules/zh

详情
Associative array mapping module name to class name. Extension modules may override the core modules (which are initialized in ).

-{zh-hans:示例; zh-hant:範例;}-
Suppose you wanted to create an API module to calibrate the wiki's awesomeness level. You would write a new extension,, putting the following in your   file:

Then you would create an  file containing an   class that extends, say, , e.g.

After installing your new extension, you could then access that module by using, e.g., https://example.org/w/api.php?action=calibrateawesomeness&level=1000.

If you want to use a factory for creating the API module, you can define it like this:

Where  is the class of the API module and   is some callable. There are more options available, see for the full syntax.