Manual:Parameters to index.php/zh

本页面是，即MediaWiki软件自身提供的主要脚本，所接受的部分参数的列表. 大多数参数在URL中一般给定为GET参数，不过也可以传作POST数据. POST实际上会在部分情况需要给出，比如刷新操作. 一些扩展可以提供额外的参数.



页面修订或版本
index.php的参数通常适用，并且具有与它们所应用的页面相关的含义. 可以通过键入以下一个或多个参数来指定页面（或其版本）： https:// en.wikipedia.org/w/index.php? title =Ferengi& curid =177126& diff =304901009& oldid =304764764

某些操作（如查看和编辑）也适用于页面的特定修订. 这样的修订由以下两个参数标识，允许省略页面的标题和id.

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

其中一些操作可以通过在 中使用专用配置设置来启用/禁用. 在可用的情况下，会列出这些本地设置.



用户首选项覆盖
以下参数将覆盖用户的某些首选项. 其他章节中解释的其他参数包括“diffonly”、“internaledit”和“externaledit”. 以下参数会影响除“render”和“raw”之外的所有操作.



查看和渲染
查看是默认操作. 如果没有向URL添加其他操作，则使用. 此操作显示页面、修订或同一页面或两个不同页面的两个修订之间的差异. 以下是（部分）列表.


 * diff
 * 该参数的值标识修订；则返回另一个修订与此修订之间的差异：


 * 如果 未通过，则显示本次修订与同一文章上一次修订之间的差异；
 * 否则，将显示 给出的修订与此修订之间的差异；此参数的值可以是修订id，值 或 用于标识相对于 给出的修订的修订，值 则用于标识页面的最新修订；
 * 请注意， 和 不需要是同一篇文章的两个修订版，可以比较两个不同页面的两个版本


 * redirect
 * 如果此参数的值为“no”，并且页面是重定向，则显示页面本身，而不是重定向的目标；此参数仅对 和 有效，并且仅在未给定 或 的情况下有效，因为这是唯一显示目标文章而不是重定向的情况；


 * rdfrom
 * 当页面是从外部wiki进行重定向的结果时，此参数“告知”是哪个wiki，以便可以显示“从…重定向”行


 * diffonly
 * 重写用户在请求diff时是否呈现页面的偏好，例如


 * search
 * 如果非空（并且启用了搜索），则覆盖所有其他参数并执行搜索

以下参数仅适用于类别.


 * from
 * 如果页面是一个类别，则仅列出排序键等于或跟随该参数值的条目；
 * 示例： https://en.wikipedia.org/w/index.php?title=Special:Log&type=upload & from =20070814233520&until=20070814233625
 * 链接到2007年8月14日23:35:20至23:36:25上传的所有图像的日志


 * until
 * 如果页面是一个类别，则仅列出排序键位于该参数值之前的条目；仅在未传递 from is added, it works the other way around, listing all edits after the timestamp
 * 示例： https://en.wikipedia.org/w/index.php?title=Special:Contributions&offset=20090815195334 &dir=prev &contribs=user&target=Atlgirl052005
 * 显示在时间戳20090815195334后立即发生的编辑（未显示20090815195364）.
 * 仅显示页面上第一次编辑的示例： https://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_(technical)&action=history& dir=prev &limit=1


 * feed
 * 则返回用于历史中的改变的馈送；允许的值是 和 . 可以使用禁用.


 * go
 * （反对-应该避免，因为它已经被取代） 显示历史的第一页（最早）

纯文本
传递 将返回页面或修订版的源代码. 出于缓存和安全原因，这通常只能通过script路径使用，即. While "short urls" like  are only meant for action=view, they unofficially tend to work for other actions as well. This is expressly discouraged for action=raw as it leads to less effective caching and bypasses automatic purging after edits.


 * templates
 * 如果传递值 ，则页面中的模板将被展开；


 * ctype
 * 返回原始内容时要在HTTP标头中使用的内容类型值，而不是默认的 ；这只能是允许的类型之一，当前为 、 和


 * oldid
 * 要返回的特定修订的id


 * direction
 * 、 或 ；而不是oldid指定的修订，返回其后面的修订、前面的修订或当前（最后）修订；


 * section
 * 将输出限制为文档的特定部分或子部分. 节是用非负整数指定的：节0是任何命名节之前的节，节1是第一个命名节或小节，依此类推. 编号方案将节和小节视为相同. 部分和子部分的列表可以通过带有api.php?action=parse&text={{:My_page}}&#95;&#95;TOC&#95;&#95;&prop=sections的neneneba api获得.


 * 範例



編輯和送出
编辑和提交操作执行的操作几乎相同. 默认情况下，它们为页面返回一个“编辑页面”表单. 通过传递其他参数可以获得不同的结果；某些结果（例如保存页面的新版本）只能使用POST获得. 此操作采用用于指定页面或页面修订的标准参数.



影响编辑表单的选项
以下选项会对编辑表单产生影响. （注意：“section”也会影响页面的保存方式. 此外，“preload”和“preloadparams”仅适用于wikitext内容模型）


 * section
 * 指定文档中要预加载和编辑的节的索引；节从0开始按顺序编号；第0节是文章第一节标题之前的部分；值 用于将新的节追加到文档中；


 * preload
 * 指定一个页面，如果要编辑的页面或节不存在，则使用该页面的wikitext作为编辑表单中文本区域的初始值；如果存在，则忽略预加载命令；另见；
 * 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   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 rSVN18112; 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;


 * 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 )