Php 在电子邮件中发送下载的页面url,并在同一窗口中打开此url

Php 在电子邮件中发送下载的页面url,并在同一窗口中打开此url,php,file,email,download,Php,File,Email,Download,我有download.php文件: $file = // path to file if ( file_exists($file) ) { header('Content-Description: File Transfer'); header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment; filename=m

我有
download.php
文件:

 $file = // path to file 


    if ( file_exists($file) ) {
        header('Content-Description: File Transfer');
        header('Content-Type: application/vnd.ms-excel'); 
        header('Content-Disposition: attachment; filename=myfile.csv'); 
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Cache-Control: must-revalidate');
        header('Pragma: public');
        header('Content-Length: ' . filesize($file));
        readfile($file);


        exit;
    }
因此,如果打开
http://mysite.com/download.php
csv
文件已下载

我想通过电子邮件发送此url,为此我做:

    $to = // recipient
    $title = // msg title
    $download_url = 'http://mysite.com/download.php';
    $msg = 'some text <a href="'.$download_url.'" target="_self">download file</a>';

    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";

    mail($to, $title, $msg, $headers);
$to=//收件人
$title=//消息标题
$download\u url='1http://mysite.com/download.php';
$msg='一些文本';
$headers='MIME版本:1.0'。“\r\n”;
$headers.='内容类型:文本/html;字符集=utf-8'。“\r\n”;
邮件($to、$title、$msg、$headers);
我的问题是:当点击“下载文件”链接(在电子邮件中)时,会在浏览器中打开另一个窗口


问题:有可能不打开另一个窗口,而是保持相同的窗口,以便下载文件?

我认为,这将由您的网络客户端(如outlook)处理。你不受客户的影响