Chr*_*sDK 1 cakephp cakephp-1.3
如何通过CakePHP中的Html Helper截断链接?
这本书只截断文本字符串,但如何截断这样的链接?
$this->Html->link('This is a very long link that needs to be truncated', '/pages/home', array('class' => 'button', 'target' => '_blank'));
Run Code Online (Sandbox Code Playgroud)
谢谢
将用法与TextHelper :: truncate方法结合使用.例:
$this->Html->link(
$this->Text->truncate('This is a very long link that needs to be truncated'),
'/pages/home',
array('class' => 'button', 'target' => '_blank')
);
Run Code Online (Sandbox Code Playgroud)