本文整理匯總了PHP中file::downloadfile方法的典型用法代碼示例。如果您正苦於以下問題:PHP file::downloadfile方法的具體用法?PHP file::downloadfile怎麽用?PHP file::downloadfile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類file
的用法示例。
在下文中一共展示了file::downloadfile方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: dodownloadfile
function dodownloadfile()
{
$filename = $this->get[2];
$filename = str_replace('*', '.', $filename);
$filedir = HDWIKI_ROOT . "/data/db_backup/" . $filename;
file::downloadfile($filedir);
}
示例2: dodownload
function dodownload()
{
if (!isset($this->get[2]) || !is_numeric($this->get[2])) {
$this->message($this->view->lang['parameterError'], 'BACK');
}
$result = $_ENV['attachment']->get_attachment('id', $this->get[2], 0);
if (!(bool) ($attachment = $result[0])) {
$this->message($this->view->lang['attachIsNotExist'], 'BACK');
}
if ($this->user['uid'] != $attachment['uid']) {
// 判斷金幣
$credit1 = $this->user['credit1'];
// 擁有金幣數
$coindown = $attachment['coindown'];
// 下載此附件需要消耗金幣數
if (0 > $credit1 - $coindown) {
// 金幣不足
$this->message($this->view->lang['goldNotEnough'], "index.php?doc-view-" . $attachment['did'], 0);
}
// 扣除金幣
$_ENV['user']->add_credit($this->user['uid'], 'attachment-down', 0, -$coindown);
// 增加金幣
$_ENV['user']->add_credit($attachment['uid'], 'attachment-down', 0, $coindown);
}
$_ENV['attachment']->update_downloads($attachment['id']);
file::downloadfile($attachment['attachment'], $attachment['filename']);
}
示例3: dodownload
function dodownload()
{
if (!isset($this->get[2]) || !is_numeric($this->get[2])) {
$this->message($this->view->lang['parameterError'], 'BACK');
}
$result = $_ENV['attachment']->get_attachment('id', $this->get[2], $this->get[3]);
if (!(bool) ($attachment = $result[0])) {
$this->message($this->view->lang['attachIsNotExist'], 'BACK');
}
$_ENV['attachment']->update_downloads($attachment['id']);
file::downloadfile($attachment['attachment'], $attachment['filename']);
}