0

实际上我想将opencart下载路径更改为新网站,已经下载文件夹是:

/系统/下载

配置文件

define('DIR_DOWNLOAD', '/system/download/');

这是来自的代码controller/account/download.php

if ($download_info) {
    $file = DIR_DOWNLOAD . $download_info['filename'];
    $mask = basename($download_info['mask']);

    if (!headers_sent()) {
        if (file_exists($file)) {
            header('Content-Type: application/octet-stream');
            header('Content-Disposition: attachment; filename="' . ($mask ? $mask : basename($file)) . '"');
            header('Expires: 0');
            header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
            header('Pragma: public');
            header('Content-Length: ' . filesize($file));

            if (ob_get_level()) {
                ob_end_clean();
            }

            readfile($file, 'rb');

            exit();
        } else {
            exit('Error: Could not find file ' . $file . '!');
        }
    } else {
        exit('Error: Headers already sent out!');
    }
} else {
    $this->response->redirect($this->url->link('account/download', '', 'SSL'));
}

我想购买一个新服务器只是为了下载,现在我想将 opencart 下载路径更改为新服务器。我怎样才能做到这一点?

已经下载的系统是这样的:

https://example.com/index.php?route=account/download/download&download_id=16

它将从此目录获取文件:

/系统/下载/example.zip

但我想从新服务器获取文件:

https://newserver.com/download/example.zip

可能吗?我改变了DIR_DOWNLOAD,但没有成功。任何想法?

4

1 回答 1

1

是的,您可以,轻松进行:

$newserv = "http://newserver.com/";
$file = $newserv . $download_info['filename'];
$mask = basename($download_info['mask']);
于 2017-07-20T07:45:06.617 回答