IBOS open source
  • Namespace
  • Class

Namespaces

  • application
    • core
      • cache
        • driver
        • provider
      • components
      • controllers
      • engines
        • local
        • sae
      • model
      • modules
      • utils
      • widgets
    • modules
      • article
        • controllers
        • core
        • model
        • utils
      • calendar
        • controllers
        • model
        • utils
      • contact
        • controllers
        • model
        • utils
      • dashboard
        • controllers
        • model
        • utils
      • department
        • components
        • model
        • utils
      • diary
        • components
        • controllers
        • model
        • utils
        • widgets
      • email
        • controllers
        • core
        • model
        • utils
      • main
        • behaviors
        • components
        • controllers
        • model
        • utils
        • widgets
      • message
        • controllers
        • core
          • co
          • wx
            • callback
            • event
        • model
        • utils
      • mobile
        • components
        • controllers
        • utils
      • position
        • components
        • model
        • utils
      • recruit
        • components
        • controllers
        • core
        • model
        • utils
        • widgets
      • role
        • model
        • utils
      • user
        • components
        • controllers
        • model
        • utils
      • vote
        • components
        • controllers
        • model
        • utils
      • weibo
        • controllers
        • core
        • model
        • utils

Classes

  • Api
  • ApiCode
  • Attach
  • Cache
  • Cloud
  • Convert
  • Credit
  • Database
  • DateTime
  • Env
  • File
  • Ftp
  • IBOS
  • Image
  • Mail
  • Module
  • Org
  • Page
  • PHPExcel
  • String
  • System
  • Upgrade
  • Url
  • WebSite
  • Xml
  • XMLParse

Class Convert

Namespace: application\core\utils
Copyright: Copyright © 2012-2013 IBOS Inc
Author: banyanCheung banyan@ibos.com.cn
Located at system/core/utils/Convert.php

Methods summary

public static integer
# ConvertBytes( integer $val )

根据数值计算出文件大小

根据数值计算出文件大小

Parameters

$val

Returns

integer
public static string
# sizeCount( integer $size )

字节格式化单位

字节格式化单位

Parameters

$size
大小(字节)

Returns

string
返回格式化后的文本
public static string
# formatDate( string $timestamp, string $format = 'dt', string $timeOffset = '9999', string $uformat = '' )

格式化时间

格式化时间

Parameters

$timestamp
时间戳
$format
dt=日期时间 d=日期 t=时间 u=个性化 其他=自定义 默认为'dt'
$timeOffset
时区偏移
$uformat
用户自定义格式

Returns

string
public static string
# RGBToHex( string $rgb )

RGB 转 十六进制

RGB 转 十六进制

Parameters

$rgb
RGB颜色的字符串 如:rgb(255,255,255);

Returns

string
十六进制颜色值 如:#FFFFFF
public static array
# hexColorToRGB( string $hexColor )

十六进制颜色转 RGB

十六进制颜色转 RGB

Parameters

$hexColor
十六颜色 ,如:#ff00ff

Returns

array
RGB数组
public static string
# convertIp( string $ip )

转换IP

转换IP

Parameters

$ip
要转换的ip

Returns

string
public static string
# convertTinyIp( type $ip, type $ipDataFile )

转换IP (简单版本)

转换IP (简单版本)

Parameters

$ip
$ipDataFile

Returns

string
public static string
# convertFullIp( string $ip, string $ipDataFile )

转换IP (全格式ip数据库版本)

转换IP (全格式ip数据库版本)

Parameters

$ip
要转换的ip地址
$ipDataFile
ip数据库文件

Returns

string
转换结果
public static string
# implodeArray( array $array, array $skip = array() )

转换一个数组为字符串

转换一个数组为字符串

Parameters

$array
待处理的数组
$skip
要跳过处理的数组参数

Returns

string
处理后的字符串
public static 返回新的一维数组
# getSubByKey( $pArray, $pKey = "", $pCondition = "" )

取一个二维数组中的每个数组的固定的键知道的值来形成一个新的一维数组

取一个二维数组中的每个数组的固定的键知道的值来形成一个新的一维数组

Parameters

$pArray
一个二维数组
$pKey
数组的键的名称
$pCondition

Returns

返回新的一维数组
public static string
# ToChinaseNum( integer $num )

转换一个阿拉伯数字为中文数字

转换一个阿拉伯数字为中文数字

Parameters

$num

Returns

string
转换后的中文数字
public static
# iIconv( <string> $str, <string> $inCharset, <string> $outCharset = CHARSET, <boolean> $forceTable = false )

编码转换

编码转换

Parameters

$str
要转码的字符
$inCharset
输入字符集
$outCharset
输出字符集(默认当前)
$forceTable
强制使用码表(默认不强制)
public static string
# getPY( type $string, type $first = false, $phonetic = false )

获取$string的拼音

获取$string的拼音

Parameters

$string
词条字符串
$first
是否只取首字
$phonetic

Returns

string
public static string
# unescape( string $str )

模拟JS的unescape函数,解码 %u6D4B %u8BD5 %u6A21 %u677F %u54AF 诸如此类的字符

模拟JS的unescape函数,解码 %u6D4B %u8BD5 %u6A21 %u677F %u54AF 诸如此类的字符

Parameters

$str

Returns

string
public static
# exportCsv( string $name, array $header, array $body )

通用导出CSV函数

通用导出CSV函数

Parameters

$name
文件名
$header
头部
$body
与头部表头对应的数据
IBOS open source API documentation generated by ApiGen