gpt4 book ai didi

cakephp - 如何使用 $this->Html->link(..); 分配 ID 和类?

转载 作者:行者123 更新时间:2023-12-04 14:05:10 24 4
gpt4 key购买 nike

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com