Yaf_Session::del
PHP Manual
PHP Manual»Yaf_Session»Yaf_Session::del

Yaf_Session::del

(Yaf >=1.0.0)

Yaf_Session::del — Remove a session key

Beschreibung

public function Yaf_Session::del(string $name): bool

Removes a session key and its value.

Parameter-Liste

name

The session key to remove.

Rückgabewerte

Returns true on success, or false on failure.

Beispiele

Beispiel #1 Yaf_Session::del() example

<?php
class VerifyController extends Yaf_Controller_Abstract
{
    public function captchaAction()
    {
        $session = Yaf_Session::getInstance();
        $session->start();

        $expected = $session->get("captcha_code");

        // one-time code: remove it right after use
        $session->del("captcha_code");

        if ($expected === null
            || $this->getRequest()->getPost("code") !== $expected) {
            echo "invalid captcha";
        }
    }
}
?>

Siehe auch

To Top