CakePHP链接和标签

时间:2015-03-22 05:24:26

标签: cakephp hyperlink tags

我正在使用CakePHP。到目前为止,我无法将段落标记和CakePHP链接组合在一行中。该链接继续在另一行打印。

到目前为止,我已尝试过这些:

<?php
    $arr = array('<p>Please download the file ', $this->Html->link('here', array('controller' => 'users', 'action' => 'download')), '</p>');
    echo join(" ", $arr);
?>

<?php echo '<p>Please download the file ' .  $this->Html->link('here', array('controller' => 'users', 'action' => 'download')) . '</p>'; ?>

1 个答案:

答案 0 :(得分:0)

对于段落(或任何其他HTML标记),您可以使用HtmlHelper的tag method。把它们放在一起就像这样:

echo $this->Html->tag('p',
    'Please download the file ' .
    $this->Html->link('here', array(
        'controller' => 'users',
        'action' => 'download'
    ))
);