Documentation ¶
Overview ¶
*此包内主要是php中关联数组相关的操作 *本包内的数组均指map[string]interface{} *此包内主要是php中索引数组相关的操作 *本包内的数组均指[]interface{}
* 此包內是关于时间和日期的相关函数
this file contains some functions that not available in Go
字符串操作相关函数
这个包是关于数据类型转换的
Index ¶
- Constants
- Variables
- func Abs(n float64) float64
- func Acos(val complex128) complex128
- func Acosh(val complex128) complex128
- func Addslashes(str string) string
- func ArraySearchInt(arr []int, needle int) int
- func ArraySearchInt64(arr []int64, needle int64) int
- func ArraySearchString(arr []string, needle string) int
- func Array_diff(m ...interface{}) interface{}
- func Array_diff_assoc(m ...interface{}) interface{}
- func Array_key_exists(key interface{}, array interface{}) bool
- func Array_keys(array interface{}) []interface{}
- func Array_merge(m ...interface{}) interface{}
- func Array_values(array interface{}) []interface{}
- func Asin(val complex128) complex128
- func Asinh(val complex128) complex128
- func Atan(val complex128) complex128
- func Atanh(val complex128) complex128
- func Base64_decode(str string) string
- func Base64_encode(str string) string
- func Base_convert(num string, frombase, tobase int) (string, error)
- func Basename(file_path string) string
- func Bin2hex(str string) string
- func Bindec(bin string) (int64, error)
- func Boolval(val interface{}) bool
- func Ceil(f float64) float64
- func Chdir(dir string) error
- func Checkdate(month, day, year int) bool
- func Chgrp(filename string, group interface{}) error
- func Chmod(filename string, mode int) error
- func Chown(filename string, user interface{}) error
- func Chr(ascii int) string
- func Chroot(dir string) error
- func Chunk_split(str string, chunkLen int, end string) string
- func ClearError()
- func Compile(str string) (*regexp.Regexp, error)
- func Date(format string, timestamp int64) string
- func Dirname(path string) string
- func Empty(args ...interface{}) bool
- func Error(separator string) string
- func Explode(sep, s string) []string
- func File_exists(filename string) bool
- func File_get_contents(url string) string
- func File_put_contents(fileName string, write_data string) int
- func Filemtime(filename string) int64
- func Filesize(filename string) int64
- func Filetype(filename string) string
- func FloatPrecision(num float64, precision int) float64
- func Fread(fp *net.Conn, count int) string
- func Fsockopen(hostname string, port int, errno *int, errstr *string, timeout int64) *net.Conn
- func Fwrite(fp *net.Conn, data string) int
- func Gethostbyname(hostname string) string
- func Hex2bin(str string) (ret string)
- func Htmlspecialchars(s string) string
- func Htmlspecialchars_decode(s string) string
- func Htmlwrap(str string, width int, breakStr string, cut bool) string
- func Implode(sep string, strarr []string) string
- func InArrayFloat64(arr []float64, needle float64) bool
- func InArrayInt(arr []int, needle int) bool
- func InArrayInt64(arr []int64, needle int64) bool
- func InArrayString(arr []string, needle string) bool
- func In_array(single interface{}, array interface{}) bool
- func Int64join(a []int64, sep string) string
- func Int64split(s, sep string) []int64
- func Intjoin(a []int, sep string) string
- func Intsplit(s, sep string) []int
- func Intval(val interface{}) int
- func IsDir(path string) bool
- func IsFile(path string) bool
- func IsNumeric(x interface{}) bool
- func Is_array(value interface{}) int
- func Is_dir(filepath string) bool
- func Is_file(filename string) bool
- func Is_numeric(data interface{}) bool
- func Isset(args ...interface{}) bool
- func Join(arg string, array []string) string
- func Ltrim(s1, s2 string) string
- func Max(x, y float64) float64
- func Md5(str string) string
- func Md5_file(filepath string) (string, error)
- func Microtime() int64
- func Min(x, y float64) float64
- func Mkdir(filepath string, mode uint32) bool
- func Mt_rand(m ...int) int
- func MustCompile(str string) *regexp.Regexp
- func Nl2br(str string, args ...bool) string
- func Ord(str string) int
- func Parse_str(s string) map[string][]string
- func Parse_str_s(s string) map[string]string
- func Parse_url(strurl string) (map[string]string, bool)
- func Pfsockopen(hostname string, port int, errno *int, errstr *string, timeout int64) *net.Conn
- func Pow(x, y float64) float64
- func Preg_match(pattern, subject string) bool
- func Preg_match_r(pattern, subject string) ([]string, bool)
- func Preg_quote(str, delimiter string) string
- func Preg_replace(pattern, replacement interface{}, str string) string
- func QuotedPrintableDecode(data string) string
- func Quotemeta(str string) string
- func Rand(m ...int) int
- func Range(start int, end int, args ...int) []int
- func Rawurldecode(str string) string
- func Rawurlencode(str string) string
- func Realpath(path string) string
- func Rename(oldName string, newName string) bool
- func Rmdir(dirname string, args ...bool) bool
- func Round(num float64) int
- func Rtrim(s1, s2 string) string
- func Serialize(value interface{}) (result string)
- func Sha1(data string) string
- func ShowError()
- func Sleep(s int)
- func Sprintf(format string, a ...interface{}) string
- func Str_pad(str string, padLength int, padStr string, padType int) string
- func Str_repeat(str string, num int) string
- func Str_replace(from, to interface{}, str string, count ...int) string
- func Strcasecmp(str1, str2 string) bool
- func Strchr(haystack string, needle string) string
- func Strcspn(str1 string, str2 string) int
- func Strip_tags(s string) string
- func Stripslashes(str string) string
- func Stristr(haystack string, needle string) string
- func Strlen(str string) int
- func Strpos(str string, sep string) int
- func Strrchr(haystack string, needle string) string
- func Strrev(str string) string
- func Strrpos(haystack string, needle string) int
- func Strspn(str1 string, str2 string) int
- func Strstr(haystack string, needle string) string
- func Strtolower(str string) string
- func Strtotime(strTime string, args ...string) int64
- func Strtoupper(str string) string
- func Strtr(str string, from string, to string) string
- func Strval(val interface{}) string
- func Substr(str string, args ...int) string
- func Substr_count(haystack string, needle string) int
- func Substr_replace(str string, replacement string, start int, length int) string
- func Time() int64
- func Trim(s string) string
- func Type(args ...interface{}) string
- func Ucfirst(str string) string
- func Ucwords(str string) string
- func Uniqid(str string) string
- func Unlink(filename string) bool
- func Unserialize(value string) (result interface{})
- func Urldecode(str string) string
- func Urlencode(str string) string
- func Wordwrap(str string, width int, breakStr string, cut bool) string
- type ArrayMap
- type ArraySlice
- type Case
- type PhpDecoder
- type PhpObject
- func (obj *PhpObject) GetClassName() string
- func (obj *PhpObject) GetMembers() map[string]interface{}
- func (obj *PhpObject) GetPrivateMemberValue(memberName string) (interface{}, bool)
- func (obj *PhpObject) GetProtectedMemberValue(memberName string) (interface{}, bool)
- func (obj *PhpObject) GetPublicMemberValue(memberName string) (interface{}, bool)
- func (obj *PhpObject) SetClassName(cName string)
- func (obj *PhpObject) SetPrivateMemberValue(memberName string, value interface{})
- func (obj *PhpObject) SetProtectedMemberValue(memberName string, value interface{})
- func (obj *PhpObject) SetPublicMemberValue(memberName string, value interface{})
Constants ¶
const TYPE_VALUE_SEPARATOR = ':'
const VALUES_SEPARATOR = ';'
Variables ¶
var ( // ErrMalformedRegexp is returned when provided regexp string too short ErrMalformedRegexp = errors.New("Malformed Regexp") // ErrCantFindClosingSeparator is returned when provided regexp string // has wrong open/close separator configuration ErrCantFindClosingSeparator = errors.New("Cant find closing separator") )
Functions ¶
func Acos ¶
func Acos(val complex128) complex128
func Acosh ¶
func Acosh(val complex128) complex128
func Addslashes ¶
============================================================================================
func ArraySearchInt ¶
============================================================================================
func ArraySearchInt64 ¶
============================================================================================
func ArraySearchString ¶
============================================================================================
func Array_diff ¶
func Array_diff(m ...interface{}) interface{}
* 计算数组的差集 在第一个ArrayMap中但不在剩余ArrayMap中的元素
func Array_diff_assoc ¶
func Array_diff_assoc(m ...interface{}) interface{}
func Array_key_exists ¶
func Array_key_exists(key interface{}, array interface{}) bool
func Array_keys ¶
func Array_keys(array interface{}) []interface{}
func Array_merge ¶
func Array_merge(m ...interface{}) interface{}
func Array_values ¶
func Array_values(array interface{}) []interface{}
func Asin ¶
func Asin(val complex128) complex128
func Asinh ¶
func Asinh(val complex128) complex128
func Atan ¶
func Atan(val complex128) complex128
func Atanh ¶
func Atanh(val complex128) complex128
func Base64_decode ¶
func Base64_encode ¶
func Chunk_split ¶
============================================================================================
func ClearError ¶
func ClearError()
============================================================================================
func Compile ¶
Compile parses a regular expression in PHP format and returns, if successful, a Regexp object that can be used to match against text.
func Date ¶
============================================================================================
func Dirname ¶
============================================================================================
func Error ¶
============================================================================================
func File_exists ¶
func File_get_contents ¶
func File_put_contents ¶
func Filemtime ¶
============================================================================================
func Filesize ¶
============================================================================================
func Filetype ¶
============================================================================================
func FloatPrecision ¶
func Gethostbyname ¶
func Htmlspecialchars ¶
func Htmlspecialchars_decode ¶
func Htmlwrap ¶
============================================================================================
func InArrayFloat64 ¶
============================================================================================
func InArrayInt ¶
============================================================================================
func InArrayInt64 ¶
============================================================================================
func InArrayString ¶
============================================================================================
func In_array ¶
func In_array(single interface{}, array interface{}) bool
support: string, (u)int8 (u)int16 (u)int (u)int32 (u)int64
func Int64join ¶
============================================================================================
func Int64split ¶
============================================================================================
func Intjoin ¶
============================================================================================
func Intsplit ¶
============================================================================================
func Is_file ¶
============================================================================================
func Is_numeric ¶
func Is_numeric(data interface{}) bool
func Join ¶
============================================================================================
func MustCompile ¶
MustCompile is like Compile but panics if the expression cannot be parsed. It simplifies safe initialization of global variables holding compiled regular expressions.
func Parse_str ¶
============================================================================================
func Parse_str_s ¶
func Pfsockopen ¶
func Preg_match ¶
func Preg_match_r ¶
func Preg_quote ¶
func Preg_replace ¶
func QuotedPrintableDecode ¶
============================================================================================
func Quotemeta ¶
============================================================================================
func Rand ¶
============================================================================================
func Rawurldecode ¶
============================================================================================
func Rawurlencode ¶
func Rename ¶
============================================================================================
func Rmdir ¶
============================================================================================
func Serialize ¶
func Serialize(value interface{}) (result string)
func Serialize(value interface{}) (result string, err error) { buf := new(bytes.Buffer) err = encodeValue(buf, value) if err == nil { result = buf.String() } return }
func Sha1 ¶
============================================================================================
func Base64Encode(data string) string { var buf bytes.Buffer encoder := base64.NewEncoder(base64.StdEncoding, &buf) encoder.Write([]byte(data)) encoder.Close() return buf.String() }
/* ============================================================================================ */
func Base64Decode(data string) string { data = strings.Replace(data, "\r", "", -1) data = strings.Replace(data, "\n", "", -1) var buf = bytes.NewBufferString(data) var res bytes.Buffer decoder := base64.NewDecoder(base64.StdEncoding, buf) res.ReadFrom(decoder) return res.String() }
/* ============================================================================================ */
func Md5(data string) string { var h = md5.New() h.Write([]byte(data)) return fmt.Sprintf("%x", h.Sum(nil)) }
============================================================================================
func ShowError ¶
func ShowError()
============================================================================================
func Str_pad ¶
============================================================================================
func Str_repeat ¶
============================================================================================
func Str_replace ¶
func Strcasecmp ¶
func Strchr ¶
============================================================================================
func Strcspn ¶
============================================================================================
func Strip_tags ¶
============================================================================================
func Stripslashes ¶
============================================================================================
func Stristr ¶
============================================================================================
func Strrchr ¶
============================================================================================
func Strrev ¶
============================================================================================
func Strrpos ¶
============================================================================================
func Strspn ¶
============================================================================================
func Strstr ¶
============================================================================================
func Strtolower ¶
func Strtotime ¶
============================================================================================
func Strtoupper ¶
func Strtr ¶
============================================================================================
func Substr_count ¶
============================================================================================
func Substr_replace ¶
============================================================================================
func Ucfirst ¶
============================================================================================
func Ucwords ¶
============================================================================================
func Unlink ¶
============================================================================================
func Unserialize ¶
func Unserialize(value string) (result interface{})
func Unserialize(value string) (result interface{}, err error) { decoder := &PhpDecoder{ source: strings.NewReader(value), } result, err = decoder.DecodeValue() return }
func Urldecode ¶
============================================================================================
Types ¶
type ArraySlice ¶
type ArraySlice []interface{}
func Array_chunk ¶
func Array_chunk(input ArraySlice, size int) ArraySlice
type PhpDecoder ¶
type PhpDecoder struct {
// contains filtered or unexported fields
}
func (*PhpDecoder) DecodeValue ¶
func (decoder *PhpDecoder) DecodeValue() (value interface{}, err error)
all integer is int64,float number is float64
type PhpObject ¶
type PhpObject struct {
// contains filtered or unexported fields
}
func NewPhpObject ¶
func NewPhpObject() *PhpObject