本文整理汇总了PHP中F3::http404方法的典型用法代码示例。如果您正苦于以下问题:PHP F3::http404方法的具体用法?PHP F3::http404怎么用?PHP F3::http404使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F3
的用法示例。
在下文中一共展示了F3::http404方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: throttled
/**
Transmit a file for downloading by HTTP client; If kilobytes per
second is specified, output is throttled (bandwidth will not be
controlled by default); Return TRUE if successful, FALSE otherwise
@param $_file string
@param $_kbps integer
@public
**/
public static function send($_file, $_kbps = 0)
{
$_file = F3::resolve($_file);
if (!file_exists($_file)) {
F3::http404();
return FALSE;
}
if (PHP_SAPI != 'cli' && !F3::$global['QUIET'] && !headers_sent()) {
header(F3::HTTP_Content . ': application/octet-stream');
header(F3::HTTP_Disposition . ': ' . 'attachment; filename=' . basename($_file));
header(F3::HTTP_Length . ': ' . filesize($_file));
F3::httpCache(0);
ob_end_flush();
}
$_max = ini_get('max_execution_time');
$_ctr = 1;
$_handle = fopen($_file, 'r');
$_time = time();
while (!feof($_handle) && !connection_aborted()) {
if ($_kbps > 0) {
// Throttle bandwidth
$_ctr++;
$_elapsed = microtime(TRUE) - $_time;
if ($_ctr / $_kbps > $_elapsed) {
usleep(1000000.0 * ($_ctr / $_kbps - $_elapsed));
}
}
// Send 1KiB and reset timer
echo fread($_handle, 1024);
set_time_limit($_max);
}
fclose($_handle);
return TRUE;
}
示例2: Axon
<?php
// Retrieve matching record
$kul = new Axon('kul');
$kul->load('tc="{@PARAMS.tc}"');
if (!$kul->dry()) {
// Populate REQUEST global with retrieved values
$kul->copyTo('REQUEST');
// Render blog.htm template
F3::set('pagetitle', 'Kullanıcıyı güncelle');
F3::set('template', 'kul');
F3::call('render');
} else {
// Invalid blog entry; display our 404 page
F3::http404();
}