+ -
当前位置:首页 → 问答吧 → 参数传送到视图问题

参数传送到视图问题

时间:2011-11-24

来源:互联网

代码如下(传不到视图页) ,但是用预设的$file="/var/www/test11.txt";的话就能够传的到 这是怎么回事阿
controller:
PHP code
function indexAction()
    {
        $file_dir = @$_POST["dir"]; //文件路径为当前目录    
        $file_name = @$_POST["file_name"]; //文件名
        $file=$file_dir.$file_name;
        //$file="/var/www/test11.txt";
        $this->view->downfile = $file;
        echo $this->view->render('download/download.phtml');
    }


view:
PHP code
$file = $this->downfile;

if (file_exists($file)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename='.basename($file));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    ob_clean();
    flush();
    readfile($file);
    exit;
}
//$file = $this->downfile;
else{echo $file.'ssa';}


作者: yyszj0911   发布时间: 2011-11-24

值是怎么post过来的呢?

作者: ohmygirl   发布时间: 2011-11-24