我的应用程序中有一个功能,用户可以将文件上传到网络服务器。然后,这些上传的文件将出现在另一个页面中,其他类型的用户可以单击该链接。单击链接后,将打开一个新选项卡,并显示该文件。
但我似乎无法做到。使用'target'=> '_blank'不起作用,或者我可能把它放在代码的错误部分。
在我的情况下,当您单击链接时,该文件将加载到同一选项卡上。
这是我的代码:
<?php
echo $this->Html->link($staff_uploads['StaffUpload']['title'], array(
'controller' => 'websites',
'action' => 'view',
'target' => '_blank',
$staff_uploads['StaffUpload']['iduploads']
)
);
?>
提前谢谢!
答案 0 :(得分:4)
正确的代码是:
<?php
echo $this->Html->link($staff_uploads['StaffUpload']['title'], array(
'controller' => 'websites',
'action' => 'view',
$staff_uploads['StaffUpload']['iduploads']
), array('target' => '_blank')
);
?>
请按照burzum的建议阅读文档。
答案 1 :(得分:1)