Answers for "twig superglobal post"

PHP
0

twig superglobal post

/***************************************************************************************************
     *                                       GET POST SESSION SERVER ET REQUEST                                       *
     ***************************************************************************************************/
    /**
     * permet d'utiliser les $_GET, $_POST, $_SESSION, $_SERVER et $_REQUEST dans les twigs
     * @param string $type post get request session ou server
     * @param string $var variable
     * @return string
     */
    function dollar($type, $var)
    {
        switch ($type) {
            case 'post':
                return $_POST[$var];
                break;
            case 'get':
                return $_GET[$var];
                break;
            case 'request':
                return $_REQUEST[$var];
                break;
            case 'session':
                return $_SESSION[$var];
                break;
            case 'server':
                return $_SERVER[$var];
                break;
        }
    }
Posted by: Guest on October-10-2021

Browse Popular Code Answers by Language