【发布时间】:2010-11-24 04:48:08
【问题描述】:
我正在使用 CakePHP。
这行代码会生成一个<img>标签:
$html->image('image.png', array('alt', 'Alternative text'));
这将产生相同的东西,但它会使图像可点击:
$html->image('image.png', array('alt' => 'Alternative text', 'url' => 'http://www.example.com'));
目前我了解,但是如果我想给<a> 标签添加属性,我该怎么办。
这样做:
$html->image('image.png', array('alt' => 'Alternative text', 'url' => 'http://www.example.com/', 'class' => 'aClass'));
将属性添加到<img> 而不是<a>。输出是这样的:
<a href="http://www.example.com/">
<img src="image.png" alt="Alternative text" class="aClass" />
</a>
但我想要这样的东西:
<a href="http://www.example.com/" class="aClasse">
<img src="image.png" alt="Alternative text" />
</a>
我尝试使用$html->image() 作为第一个参数,但它不起作用。
有什么想法吗?
【问题讨论】:
标签: php cakephp html-helper