如何在cake php中添加图像以形成postlink?

时间:2015-10-12 09:17:28

标签: cakephp

这就是我现在所拥有的。

$this->Form->postLink(
    __('Delete Client'), 
    ['action' => 'delete', $client->id], 
    ['confirm' => __('Are you sure you want to delete # {0}?', $client->id)]
)  

如何使用options数组将图像添加到此链接?

2 个答案:

答案 0 :(得分:1)

$this->Form->postLink(
    $this->Html->image(
        "action-delete.svg", 
        ["alt" => "Delete Client", 'class' => 'action-link']
    ), 
    ['controller' => 'clients', 'action' => 'delete', $client->id],
    ['escape' => false, 'confirm' => __('Are you sure you want to delete # {0}?', $client->id)]
) 

答案 1 :(得分:0)

请尝试我的作品完美!

   echo $this->Form->postLink($this->Html->image('1.png'), ['action' => 'delete',$client->id],['escape' => false, 'title' => 'Delete', 'confirm' => __('Are you sure you want to delete # {0}?'),$client->id)]);?>

谢谢!