选择语言 :

Core_HTML

HTML输出核心类

API - Core_HTML

author
呼吸二氧化碳 jonwang@myqee.com
category
MyQEE
package
System
subpackage
Core
copyright
Copyright © 2008-2013 myqee.com
license
http://www.myqee.com/license.html

HTML::chars( $value , $double_encode = true)

Convert special characters to HTML entities. All untrusted content should be passed through this method to prevent XSS injections.

echo HTML::chars($username);

参数列表

参数 类型 描述 默认值
$value string String to convert
$double_encode boolean Encode existing entities bool true
返回值
  • string

HTML::entities( $value , $double_encode = true)

Convert all applicable characters to HTML entities. All characters that cannot be represented in HTML with the current character set will be converted to entities.

echo HTML::entities($username);

参数列表

参数 类型 描述 默认值
$value string String to convert
$double_encode boolean Encode existing entities bool true
返回值
  • string

HTML::anchor( $uri , $title = null, $attributes = null, $protocol = null)

Create HTML link anchors. Note that the title is not escaped, to allow HTML elements within links (images, etc).

echo HTML::anchor('/user/profile', 'My Profile');

参数列表

参数 类型 描述 默认值
$uri string URL or URI string
$title string Link text null
$attributes array HTML anchor attributes null
$protocol string Use a specific protocol null
返回值
  • string

HTML::file_anchor( $file , $title = null, $attributes = null, $protocol = null)

Creates an HTML anchor to a file. Note that the title is not escaped, to allow HTML elements within links (images, etc).

echo HTML::file_anchor('media/doc/user_guide.pdf', 'User Guide');

参数列表

参数 类型 描述 默认值
$file string Name of file to link to
$title string Link text null
$attributes array HTML anchor attributes null
$protocol string Non-default protocol, eg: ftp null
返回值
  • string

HTML::obfuscate( $string )

Generates an obfuscated version of a string. Text passed through this method is less likely to be read by web crawlers and robots, which can be helpful for spam prevention, but can prevent legitimate robots from reading your content.

echo HTML::obfuscate($text);

参数列表

参数 类型 描述 默认值
$string string String to obfuscate
返回值
  • string

HTML::email( $email )

Generates an obfuscated version of an email address. Helps prevent spam robots from finding email addresses.

echo HTML::email($address);

参数列表

参数 类型 描述 默认值
$email string Email address
返回值
  • string

HTML::mailto( $email , $title = null, $attributes = null)

Creates an email (mailto:) anchor. Note that the title is not escaped, to allow HTML elements within links (images, etc).

echo HTML::mailto($address);

参数列表

参数 类型 描述 默认值
$email string Email address to send to
$title string Link text null
$attributes array HTML anchor attributes null
返回值
  • string

HTML::style( $file , $attributes = null, $index = false)

Creates a style sheet link element.

echo HTML::style('media/css/screen.css');

参数列表

参数 类型 描述 默认值
$file string File name
$attributes array Default attributes null
$index boolean Include the index page bool false
返回值
  • string

HTML::script( $file , $attributes = null, $index = false)

Creates a script link.

echo HTML::script('media/js/jquery.min.js');

参数列表

参数 类型 描述 默认值
$file string File name
$attributes array Default attributes null
$index boolean Include the index page bool false
返回值
  • string

HTML::image( $file , $attributes = null, $index = false)

Creates a image link.

echo HTML::image('media/img/logo.png', array('alt' => 'My Company'));

参数列表

参数 类型 描述 默认值
$file string File name
$attributes array Default attributes null
$index unknown bool false
返回值
  • string

HTML::attributes( $attributes = null)

Compiles an array of HTML attributes into an attribute string. Attributes will be sorted using HTML::$attribute_order for consistency.

echo '<div'.HTML::attributes($attrs).'>'.$content.'</div>';

参数列表

参数 类型 描述 默认值
$attributes array Attribute list null
返回值
  • string