本文整理匯總了PHP中OC_Request::isUserAgent方法的典型用法代碼示例。如果您正苦於以下問題:PHP OC_Request::isUserAgent方法的具體用法?PHP OC_Request::isUserAgent怎麽用?PHP OC_Request::isUserAgent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OC_Request
的用法示例。
在下文中一共展示了OC_Request::isUserAgent方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testUserAgent
/**
* @dataProvider userAgentProvider
*/
public function testUserAgent($testAgent, $userAgent, $matches)
{
$_SERVER['HTTP_USER_AGENT'] = $testAgent;
$this->assertEquals($matches, OC_Request::isUserAgent($userAgent));
}
示例2: setContentDispositionHeader
/**
* Sets the content disposition header (with possible workarounds)
* @param string $filename file name
* @param string $type disposition type, either 'attachment' or 'inline'
*/
public static function setContentDispositionHeader($filename, $type = 'attachment')
{
if (OC_Request::isUserAgent(array(OC_Request::USER_AGENT_IE, OC_Request::USER_AGENT_ANDROID_MOBILE_CHROME, OC_Request::USER_AGENT_FREEBOX))) {
header('Content-Disposition: ' . rawurlencode($type) . '; filename="' . rawurlencode($filename) . '"');
} else {
header('Content-Disposition: ' . rawurlencode($type) . '; filename*=UTF-8\'\'' . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"');
}
}