Manual:WebRequest.php

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Manual:WebRequest.php and the translation is 36% complete.

Other languages:
English • ‎español • ‎français • ‎polski • ‎português do Brasil • ‎中文 • ‎日本語

詳細

The WebRequest class which encapsulates getting at data passed in the URL or via a POSTed form, handling remove of "magic quotes" slashes, stripping illegal input characters and normalizing Unicode sequences.

RequestContext.php を通して標準の WebRequest にアクセスできます。

このクラスの追加的なインスタンスを作成してはいけません。

代わりに、DerivativeRequest を作成するか、または利用者のリクエスト コンテキストがない場合は FauxRequest を使用してください。

関数

  • getVal: get a scalar or null if the parameter was not passed
  • getInt: same as before, but the value returned is an integer
  • getBool: same as getVal, but returns a boolean value
  • getArray: get an array or null if the parameter was not passed. If the parameter is a scalar, it will return an array with a single element.
  • getCheck: return a boolean whether the parameter was passed, this is useful for checkboxes.
  • getCookie: get a cookie from the $_COOKIE jar
  • wasPosted: returns a bool whether the request was posted

... many more, this is a partial list.

WebRequestUpload

WebRequestUpload is an object to access the $_FILES array. It should only be called by WebRequest. A WebRequestUpload object is generated by WebRequest::getUpload().

関数

  • __construct( $request, $key )

FauxRequest

FauxRequest is a class extending WebRequest. Its purpose is to emulate a request for testing or prototyping. FauxRequest should be avoided in production code.

Also see API:Calling internally for an example.

関連項目