PHP 8.6.0 Beta 3 is available for testing

Yaf_Request_Abstract::getLanguage

(Yaf >=1.0.0)

Yaf_Request_Abstract::getLanguageRetrieve the client's preferred language

Descrizione

public function Yaf_Request_Abstract::getLanguage(): ?string

Retrieve the client's preferred language

Elenco dei parametri

Questa funzione non contiene parametri.

Valori restituiti

The preferred language string, or null if it cannot be determined.

Esempi

Example #1 Yaf_Request_Abstract::getLanguage() example

<?php
class IndexController extends Yaf_Controller_Abstract
{
    public function indexAction()
    {
        // Assuming the client sends "Accept-Language: zh-CN"
        $language = $this->getRequest()->getLanguage();

        var_dump($language);
    }
}
?>

Il precedente esempio visualizzerà qualcosa simile a:

string(5) "zh-CN"

Vedere anche:

add a note

User Contributed Notes

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