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