Manual:Parameters to index.php/zh

This page is a partial list of the parameters to, the main script of the MediaWiki software, as provided by MediaWiki itself. Most of these arguments are usually given as GET parameters in the URL, but can also be passed as POST data. POST is actually required in some cases, such as the purge action. Some extensions provide additional parameters.

页面修订或版本
Parameters to index.php usually apply and have a meaning related to the page they apply to. The page (or a version of it) can be specified by typing one or more of the following parameters: https:// en.wikipedia.org/w/index.php? title =Ferengi& curid =177126& diff =304901009& oldid =304764764

Some actions (such as view and edit) also work on a particular revision of a page. Such a revision is identified by the following two parameters, allowing the omission of the title and the id of the page.

操作
以下是 参数值的列表.

Some of these actions can be enabled/disabled by using a dedicated configuration setting in. Where available, these local settings are listed.

User preference overriding
The following parameters override some of the user's preferences. Other parameters explained in other sections are "diffonly", "internaledit", and "externaledit". The below parameters affect all actions but "render" and "raw".

View and render
View is the default action. If no other action is added to the URL,  is used. This action shows a page, a revision, or the difference between two revisions of the same or two different pages. Below is a (partial) list.


 * diff
 * the value of this parameter identifies a revision; the difference between another revision and this one is returned:


 * if  is not passed, the difference between this revision and the previous one on the same article is shown;
 * otherwise, the difference between the revision given by  and this one is shown; the value of this parameter can be a revision id, the values   or   to identify a revision relative to the one given by , and the value   to identify the latest revision of the page;
 * Note that  and   need not be two revisions of the same article, allowing two revisions of two different pages to be compared


 * redirect
 * if the value of this parameter is 'no' and the page is a redirect, the page itself is shown and not the target of the redirect; this parameter has effect only on  and   and only if neither   nor   is given, as this is the only case where the target article is shown instead of the redirect;


 * rdfrom
 * when the page is the result of following a redirect from an external wiki, this parameter tells which wiki that was, so that the "Redirected from ..." line can be shown


 * diffonly
 * override the user's preference on whether to render the page when a diff is requested, eg.


 * search
 * if non-blank (and if searches are enabled), override all other parameters and perform a search

The following parameters apply only to categories.


 * from
 * if the page is a category, only list entries whose sortkey are equal or follows the value of this parameter;
 * Example: https://en.wikipedia.org/w/index.php?title=Special:Log&type=upload & from =20070814233520&until=20070814233525
 * Links to a log of all the images uploaded on August 14, 2007 from 23:35:20 until 23:36:25


 * until
 * if the page is a category, only list entries whose sortkey precedes the value of this parameter; only used if  is not passed;

The following parameter apply only to images.


 * page
 * a page number in a multi-page media; it currently only applies to DjVu and PDF files; first page is numbered 1;

历史

 * limit
 * The number of page edits to list, the maximum is 5000 edits.
 *  Example: https://en.wikipedia.org/w/index.php?title=Special:Contributions &limit=13 &contribs=user&target=Atlgirl052005 - lists 13 edits per page.


 * dir
 * the relative order of edit history pages.
 * page edits are sorted in decreasing timestamp.


 * offset
 * uses a timestamp to specify which part of the history is displayed;
 * Returns the edits which occurred before the timestamp;
 *  Example:  https://en.wikipedia.org/w/index.php?title=Special:Contributions &offset=20090815195334 &contribs=user&target=Atlgirl052005
 * Shows the edits which occurred immediately before the timestamp 20090815195334 (20090815195334 is not shown).
 * Parameter format is yyyymmddhhmmss. So 20090815195334 was created on August 15, 2009 [20090815] at 19:53 (UTC) and 34 seconds [195334].
 * See Wikipedia:Complete diff and link guide.
 * if  is added, it works the other way around, listing all edits after the timestamp
 *  Example: https://en.wikipedia.org/w/index.php?title=Special:Contributions&offset=20090815195334 &dir=prev &contribs=user&target=Atlgirl052005
 * Shows the edits which occurred immediately after the timestamp 20090815195334 (20090815195334 is not shown).
 *  Example to show only the very first edit on a page: https://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_(technical)&action=history& dir=prev &limit=1


 * feed
 * a feed for the changes in the history is returned; allowed values are  and  . Can be disabled with.


 * go
 * (deprecated - should be avoided, because it has been superseded)  the first (earliest) page of history is shown

Raw
Passing  returns the source code of a page or revision. For security reasons, in some versions of MediaWiki this is only allowed when using the "primary script access point", that is, when using the "ugly" URL form with


 * templates
 * if passed with value, templates within the page are expanded;


 * ctype
 * the content-type value to be used in the HTTP header when returning the raw content, instead of the default ; this can only be one of the allowed types, which currently are ,  ,  , and


 * maxage
 * the value of max-age in the Cache-Control HTTP header field to be used when returning the raw page (client cache)


 * smaxage
 * the value of s-maxage in the Cache-Control HTTP header field to be used when returning the raw page (cache-server cache)


 * oldid
 * the id of a specific revision to return


 * direction
 * either,  , or  ; instead of the revision specified by oldid, returns the one following it, the one preceding it, or the current (last) one;


 * section
 * Limits output to a particular section or subsections of the document. Sections are specified with non-negative integers : section 0 being the section before any named sections, section one being the first named section or subsection and so on. The numbering scheme treats sections and subsections as identical. A list of the sections and subsections can be obtained via API with api.php?action=parse&text=&#123;&#123;:My_page&#125;&#125;&#95;&#95;TOC&#95;&#95;&prop=sections.


 * 範例

編輯和送出
The edit and submit actions perform almost the same action. By default, they return an "edit page" form for the page. Different results can be obtained by passing other arguments; some results (such as saving the new version of a page) can only be obtained using POST. This action takes the standard arguments for specifying a page or a page revision.

Options affecting the edit form
The following options produce an effect on the edit form (the first one also affects how the page is saved).


 * section
 * specifies the index of a section within a document to preload and edit; sections are numbered sequentially from 0 on; section 0 is the part of the article before the first section header; value  is used to append a new section to the document;


 * preload
 * specifies a page, of which the wikitext is used as the initial value of the textarea in the edit form if the page or section to be edited does not exist; if it exists the preload command is ignored; also see Manual:Creating pages with preloaded text;
 * Example: https://en.wikipedia.org/wiki/Talk:Main_Page?action=edit&section=new&preload=Project:Sandbox


 * preloadparams[] (or preloadparams%5B%5D): Replace  style parameters in preload text. For example https://mediawiki.org/wiki/Project:Sandbox?action=edit&section=new&preload=Manual:Creating_pages_with_preloaded_text/param_demo&preloadparams%5b%5d=first%20value&preloadparams%5b%5d=second%20value would cause Manual:Creating pages with_preloaded text/param demo to be preloaded into the edit form, but with   replaced by first value and   replaced by second value.
 * editintro
 * title of an existing article or template to be rendered above the edit form;


 * preloadtitle
 * in the case of section=new, provides initial content of the "Subject/headline" box; it can be edited before saving;
 * Example: https://en.wikipedia.org/w/index.php?title=User_talk:5dsddddd&action=edit&section=new&preloadtitle=The+%5B%5BWP%3AARS%7CArticle+Rescue+Squadron%5D%5D
 * Example with both preloadtitle and preload: https://en.wikipedia.org/wiki/User_Talk:Ikip?action=edit&section=new&preload=Template:Article_Rescue_Squadron_ invite&preloadtitle=Invitation


 * nosummary
 * 當section=new時，不顯示「主旨」框.


 * summary
 * its value is used as the edit summary in place of the default one.


 * preview
 * if set to  or , overrides user preference "" ;


 * internaledit/externaledit : overrides user preference on external editors;
 * mode
 * this parameter affects the result page if passed with value  and using an external editor;


 * undo, undoafter
 * attempts to undo a sequence of edits, from the  revision up to the   revision; technically, this is done by trying to merge the inverse of these edits with the sequence of all subsequent edits; the values of these parameters are ids of old revisions of a page; if merge is not possible, a regular edit form for that revision is returned

What to do
The following options tell the software what to do when submitting: saving, showing a preview, or showing the difference with the current version.


 * wpSave
 * this argument is generated when saving the content of an edit form returned by the server, but is not actually used nor required when submitting (see below for required arguments to save);


 * wpPreview
 * set in a POST request to request a preview of the page or section as if the value of wpTextbox1 were saved;


 * by default, returns an edit form with a preview of the value of wpTextbox1;
 * if the additional  argument is passed, only the rendering of the value of wpTextbox1 is shown, not the form and the other GUI element; this is similar to the result of saving and then viewing with  ; see  Manual:Live preview for more info;
 * the argument  is identical to wpPreview; therefore, a regular preview is returned if   is not passed;
 * wpDiff
 * set in a POST request to request a table showing the changes between the current version of the page or section and the version as if value of wpTextbox1 were saved;

Parameters that are needed to save
The following parameters are required when a user saves a page. The edit summary field may also be required if so configured (see below).


 * wpTextbox1
 * the new page/section content;


 * wpStarttime
 * the timestamp of when the user started editing the page; used to check whether the page has been deleted between this moment and the submission time (in this case, the user is asked to confirm saving);


 * wpRecreate
 * in case the page was deleted after wpStarttime, this field confirms that the page is to be saved;


 * wpEdittime
 * for new pages, it is equal to wpStarttime; otherwise, it is the timestamp of the last revision of the page; used to check edit conflicts;


 * wpEditToken
 * an edit token; this is used to avoid users from being tricked into saving a page by following a link or pressing a button in an external site. For non-logged-in users, wpEditToken is required since revision 18112; it currently contains only the characters  rather than a random string (see edit token suffix).

For the page to be saved,,  ,   and   are required in a POST request, and neither   nor   are passed. If the page was deleted after, the boolean option   is also required.

Optional additional data
The edit summary or the "ignore blank" parameter may be mandatory if "warn on blank summaries" is configured.


 * wpSummary
 * the edit summary;


 * wpMinoredit
 * if set in a save request, the edit is marked as minor; for preview and diff, it is the initial value of "this is a minor edit" checkbox in the edit form;


 * wpWatchthis
 * if passed on a save request, the page is added to the user's watchlist; if it is not passed in a save request, the page is removed from the user's watchlist; for preview or diff, this is the initial value of the "watch this page" checkbox of the edit form;


 * wpSection
 * specify the index of a section within a document to submit to; sections are numbered sequentially from 0 on; section 0 is the part of the article before the first section header; value  is used to append a new section to the document;


 * wpChangeTags
 * an optional comma-separated list of tags to be added to the edit. If any of the provided tags are not activated for manual use, the edit will be rejected.


 * wpAutoSummary
 * contains the MD5-hashing of the edit summary field as initially presented to the user in the edit form; this field is used to check if the user has modified that field before submitting: if the MD5 hashing of the value of  is the same as this field, the edit summary has not been modified;


 * wpIgnoreBlankSummary
 * save page even if user has not modified the edit summary, while they were supposed to;


 * wpTextbox2
 * in case of an edit conflict, it contains the value of wpTextbox1 of the save request that generated the conflict;


 * safemode
 * some browsers are known to have problems with editing text containing Unicode characters; when a request for an edit form come from one such browser, the non-ascii characters in the initial content of the textarea are converted into the form  and the value   is hidden in the form; when submitting, the   field indicate that the the inverse translation is to be performed; a browser is considered non-Unicode-compliant if the User-Agent HTTP header matches a regular expressions in the variable ;


 * wpScrolltop
 * used to preserve the scrollbar position in the edit textbox when loading a preview.


 * redlink
 * if the user does not have permission to edit the page, redirect to the empty article page (e.g., "Wikipedia does not have an article with this exact name") instead of showing the permission error notice; this parameter is used on red links.


 * wpExtraQueryRedirect
 * hidden input to modify after save URL and is not used by actual edit form. Intended to be used by gadgets and such.

特殊页面
Most special pages have additional parameters, specific to the function they perform. As an example, the parameters for Special:Export are outlined in

The following URL parameters provide initial values for some input fields; they can be edited before submitting the form.

Special:MovePage

 * wpReason
 * 原因的文字欄位.


 * wpNewTitle
 * 新標題的文字欄位.


 * wpLeaveRedirect
 * 是否勾選「留下重新導向頁面」複選框.

Special:BlockIP

 * wpDisableEmail
 * 是否要勾選「」複選框.


 * wpDisableUTEdit
 * 是否要勾選「」複選框.


 * wpReason
 * 預設選擇下拉式選單的項目，值應與MediaWiki:Ipbreason-dropdown中的其中一行相符.


 * wpReason-other
 * 自訂原因的文字欄位；需要


 * wpAutoBlock
 * 是否要勾選「」複選框.


 * wpWatch
 * 是否要勾選「」複選框.

Special:UserRights

 * user-reason
 * 原因的文字欄位.

Maxlag parameter
The  is used only if the software is running on a replicated database cluster.

The maxlag parameter makes it so a request is not served if there is high server traffic. maxlag parameter applies to all actions. maxlag parameter value is a number; the lower this value, the lower the traffic that causes the request not to be served. Zero is not allowed.

参见

 * m:Help:URL
 * Listing of functions
 * Snippets/Load JS and CSS by URL ( adds withJS and withCSS parameters which are processed on the client side )
 * Listing of functions
 * Snippets/Load JS and CSS by URL ( adds withJS and withCSS parameters which are processed on the client side )