状态 草稿
Todo Write me
官方最后更新时间 2008/08/14 10:19

Format Helper

A helper 设计用于,把有用的信息格式化

A helper designed to format useful information the right way.

Methods

phone()

phone($number, $format = '3-3-4') 基于指定的格式来格式化电话号码,参数如下:

phone($number, $format = '3-3-4') formats a phone number according to the specified format. It takes:

  • [string] $number 电话号码
  • [string] $number phone number
  • [string] $format 格式化参数, 默认3-3-4
  • [string] $format format string, default 3-3-4
  • returns [string] 返回被格式化后的号码。或者当格式化参数没有被应用,号码直接被传递。
  • returns [string] the formated phone number or the number passed if the format string could not have been applied

Example:

echo format::phone('0123456789');

返回结果:

It will result in HTML as:

012-345-6789

url()

url($str = )URL 的开始端提供完整的协议,参数如下 url($str = ) formats a URL to contain a protocol at the beginning.. It takes:

  • [string] $str 可能是不完整的 URL
  • [string] $str possibly incomplete URL
  • returns [string] 返回被格式化后的 URL
  • returns [string] the formated URL

Example:

echo format::url('kohanaphp.com');

返回结果:

It will result in HTML as:

http://kohanaphp.com
helpers/format.txt · 最后更改: 2008/09/16 10:21 由 ccdjh