选择语言 :

 Core_HTML::image

Creates a image link.

echo HTML::image('media/img/logo.png', array('alt' => 'My Company'));
string Core_HTML::image( string $file [, array $attributes = null , $index = bool false ] )
uses
URL::base
HTML::attributes

参数列表

参数 类型 描述 默认值
$file string File name
$attributes array Default attributes null
$index unknown bool false
返回值
  • string
File: ./core/classes/html.class.php
public static function image($file, array $attributes = null, $index = false)
{
    if (strpos($file, '://') === false)
    {
        // Add the base URL
        $file = Core::url()->base($index) . $file;
    }
    // Add the image link
    $attributes['src'] = $file;
    return '<img' . HTML::attributes($attributes) . ' />';
}