echo $this->Html->link(
'more',
array(
'controller'=>'posts',
'action'=>'view',
$post['Post']['id']
)
);
如何为此 anchor /链接分配 ID 和类?我想覆盖它的 css 规则。
最佳答案
HTML 属性可以在数组中指定为第三个参数。
echo $this->Html->link(
'more',
array(
'controller'=>'posts',
'action'=>'view',
$post['Post']['id']
),
array(
'id' => 'myId',
'class' => 'myClass'
)
);
更多信息在 Cookbook 2.x对于 2.x 版本或 Cookbook 1.3适用于 CakePHP 1.3。
关于cakephp - 如何使用 $this->Html->link(..); 分配 ID 和类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6889955/