Browser::setUserAgent PHP Method

setUserAgent() public method

Set the user agent value (the construction will use the HTTP header value - this will overwrite it)
public setUserAgent ( string $agent_string )
$agent_string string The value for the User Agent
    public function setUserAgent($agent_string)
    {
        $this->reset();
        $this->_agent = $agent_string;
        $this->determine();
    }

Usage Example

示例#1
0
文件: App.php 项目: visavi/rotorcms
 /**
  * Определение браузера
  * @return string браузер и версия браузера
  */
 public static function getUserAgent($userAgent = null)
 {
     $browser = new Browser();
     if ($userAgent) {
         $browser->setUserAgent($userAgent);
     }
     $brow = $browser->getBrowser();
     $version = implode('.', array_slice(explode('.', $browser->getVersion()), 0, 2));
     return $version == 'unknown' ? $brow : $brow . ' ' . $version;
 }
All Usage Examples Of Browser::setUserAgent