Changeset 19817 for branches/version-2_5-dev/data/class/SC_Response.php
- Timestamp:
- 2011/01/04 20:06:08 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/SC_Response.php
r19802 r19817 185 185 } 186 186 187 /** 188 * HTTPステータスコードを送出する。 189 * 190 * @param integer $code HTTPステータスコード 191 * @return void 192 * @author Seasoft (新規作成) 193 * @see Moony_Action::status() (オリジナル) 194 * @link http://moony.googlecode.com/ (オリジナル) 195 * @author YAMAOKA Hiroyuki (オリジナル) 196 * @copyright 2005-2008 YAMAOKA Hiroyuki (オリジナル) 197 * @license http://opensource.org/licenses/bsd-license.php New BSD License (オリジナル) 198 * @link http://ja.wikipedia.org/wiki/HTTP%E3%82%B9%E3%83%86%E3%83%BC%E3%82%BF%E3%82%B9%E3%82%B3%E3%83%BC%E3%83%89 (邦訳) 199 * @license http://www.gnu.org/licenses/fdl.html GFDL (邦訳) 200 * @static 201 */ 202 function sendHttpStatus($code) { 203 $protocol = $_SERVER['SERVER_PROTOCOL']; 204 $httpVersion = (strpos($protocol, '1.1') !== false) ? '1.1' : '1.0'; 205 $messages = array( 206 // Informational 1xx // 【情報】 207 100 => 'Continue', // 継続 208 101 => 'Switching Protocols', // プロトコル切替え 209 // Success 2xx // 【成功】 210 200 => 'OK', // OK 211 201 => 'Created', // 作成 212 202 => 'Accepted', // 受理 213 203 => 'Non-Authoritative Information', // 信頼できない情報 214 204 => 'No Content', // 内容なし 215 205 => 'Reset Content', // 内容のリセット 216 206 => 'Partial Content', // 部分的内容 217 // Redirection 3xx // 【リダイレクション】 218 300 => 'Multiple Choices', // 複数の選択 219 301 => 'Moved Permanently', // 恒久的に移動した 220 302 => 'Found', // 1.1 // 発見した (リクエストしたリソースは一時的に移動されているときに返される) 221 303 => 'See Other', // 他を参照せよ 222 304 => 'Not Modified', // 未更新 223 305 => 'Use Proxy', // プロキシを使用せよ 224 // 306 is no longer used but still reserved // 将来のために予約されている 225 307 => 'Temporary Redirect', // 一時的リダイレクト 226 // Client Error 4xx // 【クライアントエラー】 227 400 => 'Bad Request', // リクエストが不正である 228 401 => 'Unauthorized', // 認証が必要である 229 402 => 'Payment Required', // 支払いが必要である 230 403 => 'Forbidden', // 禁止されている 231 404 => 'Not Found', // 未検出 232 405 => 'Method Not Allowed', // 許可されていないメソッド 233 406 => 'Not Acceptable', // 受理できない 234 407 => 'Proxy Authentication Required', // プロキシ認証が必要である 235 408 => 'Request Timeout', // リクエストタイムアウト 236 409 => 'Conflict', // 矛盾 237 410 => 'Gone', // 消滅した 238 411 => 'Length Required', // 長さが必要 239 412 => 'Precondition Failed', // 前提条件で失敗した 240 413 => 'Request Entity Too Large', // リクエストエンティティが大きすぎる 241 414 => 'Request-URI Too Long', // リクエストURIが大きすぎる 242 415 => 'Unsupported Media Type', // サポートしていないメディアタイプ 243 416 => 'Requested Range Not Satisfiable', // リクエストしたレンジは範囲外にある 244 417 => 'Expectation Failed', // 期待するヘッダに失敗 245 // Server Error 5xx // 【サーバエラー】 246 500 => 'Internal Server Error', // サーバ内部エラー 247 501 => 'Not Implemented', // 実装されていない 248 502 => 'Bad Gateway', // 不正なゲートウェイ 249 503 => 'Service Unavailable', // サービス利用不可 250 504 => 'Gateway Timeout', // ゲートウェイタイムアウト 251 505 => 'HTTP Version Not Supported', // サポートしていないHTTPバージョン 252 509 => 'Bandwidth Limit Exceeded' // 帯域幅制限超過 253 ); 254 if (isset($messages[$code])) { 255 if ($httpVersion !== '1.1') { 256 // HTTP/1.0 257 $messages[302] = 'Moved Temporarily'; 258 } 259 header("HTTP/{$httpVersion} {$code} {$messages[$code]}"); 260 header("Status: {$code} {$messages[$code]}", true, $code); 261 } 262 } 187 263 }
Note: See TracChangeset
for help on using the changeset viewer.