开发者

CakePHP - how to insert new line / line break in Html helper hyperlink

开发者 https://www.devze.com 2023-04-04 08:50 出处:网络
Using the CakePHP Html helper, how does one go about inserting a line break in the anchor text? <?php echo $this->Html->link(\"My Anchor Text \\n with new line\", \'/mycontroller/myaction\'开

Using the CakePHP Html helper, how does one go about inserting a line break in the anchor text?

<?php echo $this->Html->link("My Anchor Text \n with new line", '/mycontroller/myaction'开发者_如何学Python); ?>

The above doesn't work.

Thanks...


You have to use the br tag for this purpose:

<?php echo $this->Html->link("My Anchor Text <br /> with new line", '/mycontroller/myaction', array('escape' => false)); ?>
0

精彩评论

暂无评论...
验证码 换一张
取 消