CI4 Playground v4.7.3
한국어문서
현재 요청 정보

HTTP 메서드: GET

Routes.php — match()로 여러 메서드 허용
// GET과 POST 모두 허용
$routes->match(['get', 'post'], 'examples/routing/method', 'Examples\Routing::method');

// 이 라우트에 다른 메서드(PUT, DELETE 등)로 접근하면 404 오류
컨트롤러 — 메서드 분기 처리
public function method(): string
{
    $httpMethod = $this->request->getMethod(); // 'get' 또는 'post'
    return view('examples/routing/method', [
        'httpMethod' => strtoupper($httpMethod),
    ]);
}
GET 요청
← 라우팅으로