本文整理汇总了PHP中Sys::isFunc方法的典型用法代码示例。如果您正苦于以下问题:PHP Sys::isFunc方法的具体用法?PHP Sys::isFunc怎么用?PHP Sys::isFunc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sys
的用法示例。
在下文中一共展示了Sys::isFunc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: download
/**
* Transmit headers that force a browser to display the download file dialog.
* Cross browser compatible. Only fires if headers have not already been sent.
*
* @param string $filename The name of the filename to display to browsers
* @return boolean
*
* @codeCoverageIgnore
*/
public static function download($filename)
{
if (!headers_sent()) {
while (@ob_end_clean()) {
// noop
}
// required for IE, otherwise Content-disposition is ignored
if (Sys::iniGet('zlib.output_compression')) {
Sys::iniSet('zlib.output_compression', 'Off');
}
Sys::setTime(0);
// Set headers
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private', false);
header('Content-Disposition: attachment; filename="' . basename(str_replace('"', '', $filename)) . '";');
header('Content-Type: application/force-download');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($filename));
// output file
if (Sys::isFunc('fpassthru')) {
$handle = fopen($filename, 'rb');
fpassthru($handle);
fclose($handle);
} else {
echo file_get_contents($filename);
}
return true;
}
return false;
}
示例2: _extractDomain
/**
* @param string $email
* @return string
*/
private static function _extractDomain($email)
{
$parts = explode('@', $email);
$domain = array_pop($parts);
if (Sys::isFunc('idn_to_ascii')) {
return idn_to_ascii($domain);
}
return $domain;
}