PHP 8.6.0 Beta 3 is available for testing

Yaf_Controller_Abstract::redirect

(Yaf >=1.0.0)

Yaf_Controller_Abstract::redirectRedirige a un URL

Descripción

public function Yaf_Controller_Abstract::redirect(string $url): ?bool

Redirige a un URL enviando una cabecera 302

Parámetros

url

Un URL

Valores devueltos

bool

Ejemplos

Ejemplo #1 Ejemplo de Yaf_Controller_Abstract::redirect()

<?php
class AccountController extends Yaf_Controller_Abstract
{
    public function loginAction() {
        if (!$this->getRequest()->getParam("user")) {
            // send a Location header with HTTP status 302
            $this->redirect("http://www.example.com/account/login/");
            return false; // skip auto-rendering
        }
    }
}
?>

Véase también

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top