控制器方法我有一个方法在我的控制器调用从视图
public function download($filepath){
$download_path = $_SERVER['DOCUMENT_ROOT']. "mediabox/import";
$file = $download_path + $filepath ;
if(!$file) die("I'm sorry, you must specify a file name to download.");
if(eregi("\.ht.+", $file)) die("I'm sorry, you may not download that file.");
if(!file_exists($file)) die("I'm sorry, the file doesn't seem to exist.");
$type = filetype($file);
header("Content-type: $type");
header("Content-Disposition: attachment;filename=$filename");
header('Pragma: no-cache');
header('Expires: 0');
// Send the file contents.
readfile($file);
}
在我看来,我有一个链接
<a target='_blank' class='download_dialog' onClick="???">
我想打电话给我的控制器onclick事件的下载实现方法具链接 。 这样做好吗? 我该怎么办? 感谢
如果有什么方法是在我的模型? – 2012-03-20 15:43:31
感谢它工作:) – 2012-03-20 15:48:32