php package - github.com/php2go/php2go/php - Go Packages

php

package
v0.0.0-...-8f3710a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2020 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

View Source
const (
	CaseLower = iota
	CaseUpper
)

Variables

This section is empty.

Functions

func Abs

func Abs(x float64) float64

取出绝对值

func Acos

func Acos(x float64) float64

https://www.php.net/manual/zh/function.acos.php 反余弦函数 x float64 度数

func Acosh

func Acosh(x float64) float64

https://www.php.net/manual/zh/function.acosh.php 反双曲余弦函数 x float64 度数

func Array

func Array(v ...interface{}) interface{}

https://www.php.net/manual/zh/function.array.php array()

func ArrayColumn

func ArrayColumn(arrayMap map[string]map[string]interface{}, column string) (ret []interface{})

https://www.php.net/manual/zh/function.array-column.php array_column 获取指定的key值 todo index第三个参数待实现

func ArrayCombine

func ArrayCombine(arrK ArraySlice, arrV ArraySlice) (arrayCombineMap, error)

https://www.php.net/manual/zh/function.array-combine.php array_combine()

func ArrayCountValues

func ArrayCountValues(array []interface{}) map[interface{}]uint

https://www.php.net/manual/zh/function.array-count-values.php array_count_values

func ArrayFill

func ArrayFill(startIndex int, num uint, value interface{}) map[int]interface{}

https://www.php.net/manual/zh/function.array-fill.php array_fill 数据填充 具体操作请看php链接

func ArrayFillKeys

func ArrayFillKeys(keys []interface{}, value interface{}) map[interface{}]interface{}

https://www.php.net/manual/zh/function.array-fill-keys.php array_fill_keys()

func ArrayFlip

func ArrayFlip(arr map[interface{}]interface{}) map[interface{}]interface{}

https://www.php.net/manual/zh/function.array-flip.php array_flip

func ArrayKeyExists

func ArrayKeyExists(key interface{}, arr map[interface{}]interface{}) bool

https://www.php.net/manual/zh/function.array-key-exists.php array_key_exists()

func ArrayKeys

func ArrayKeys(arr map[interface{}]interface{}) (r []interface{})

https://www.php.net/manual/zh/function.array_keys.php array_keys()

func ArrayMapMap

func ArrayMapMap(f func(item interface{}) interface{}, arr map[string]interface{}) (r []interface{})

https://www.php.net/manual/zh/function.array-map.php array_map map

func ArrayMapSlice

func ArrayMapSlice(f func(item interface{}) interface{}, arr []interface{}) (r []interface{})

https://www.php.net/manual/zh/function.array-map.php array_map slice

func ArrayMerge

func ArrayMerge(arr ...interface{}) []interface{}

https://www.php.net/manual/zh/function.array-merge.php array_merge

func ArrayPop

func ArrayPop(s []interface{}) []interface{}

https://www.php.net/manual/zh/function.array-pop.php array_pop

func ArrayPush

func ArrayPush(arr *[]interface{}, p ...interface{})

https://www.php.net/manual/zh/function.array-push.php array_push()

func ArrayValues

func ArrayValues(arr map[interface{}]interface{}) []interface{}

https://www.php.net/manual/zh/function.array-values.php array-values()

func ArrayWalkMap

func ArrayWalkMap(arr map[interface{}]interface{}, f func(item interface{}, key interface{}))

https://www.php.net/manual/zh/function.array-walk.php array_walk map todo 待完善

func ArrayWalkSlice

func ArrayWalkSlice(arr *[]interface{}, f func(item interface{}, key interface{}))

https://www.php.net/manual/zh/function.array-walk.php array_walk slice todo 待完善

func Asin

func Asin(x float64) float64

https://www.php.net/manual/zh/function.asin.php 反正弦函数 x float64 度数

func Asinh

func Asinh(x float64) float64

https://www.php.net/manual/zh/function.asinh.php 反双曲正弦函数 x float64 度数

func Atan

func Atan(x float64) float64

https://www.php.net/manual/zh/function.atan.php 反正切 x float64 度数

func Atan2

func Atan2(x, y float64) float64

https://www.php.net/manual/zh/function.atan2.php 两个参数的反正切 x y float64 度数

func Atanh

func Atanh(x float64) float64

https://www.php.net/manual/zh/function.atanh.php 反双曲正切 x float64 度数

func Checkdate

func Checkdate(m, d, y int) bool

https://www.php.net/manual/zh/function.checkdate.php checkdate()

func ChunkSplit

func ChunkSplit(body string, length uint, end string) string

https://www.php.net/manual/zh/function.chunk-split.php chunk_split()

func Cos

func Cos(x float64) float64

https://www.php.net/manual/zh/function.cos.php 增加余弦函数 x float64 度数

func Cosh

func Cosh(x float64) float64

https://www.php.net/manual/zh/function.cosh.php 双曲余弦 x float64 度数

func Count

func Count(v []interface{}) int

获取数组长度

func Date

func Date(format string, timestamp int64) string

https://www.php.net/manual/zh/function.date.php date()

func Echo

func Echo(orgs ...interface{})

func Empty

func Empty(s interface{}) bool

https://www.php.net/manual/zh/function.empty.php empty

func Explode

func Explode(delimiter, s string) []string

https://www.php.net/manual/zh/function.explode.php explode()

func FileGetContents

func FileGetContents(filename string) ([]byte, error)

https://www.php.net/manual/zh/function.file-get-contents.php file_get_contents todo 这个只能获取本地地址内容 http 或者 https远程链接还是获取不到的内容的 需要使用网络包获取

func FilePutContents

func FilePutContents(filename string, data []byte) error

https://www.php.net/manual/zh/function.file-put-contents.php file_put_contents

func HttpBuildQuery

func HttpBuildQuery(s map[string]string) (rs string)

https://www.php.net/manual/zh/function.http-build-query.php http_build_query()

func IsBool

func IsBool(v interface{}) bool

https://www.php.net/manual/zh/function.is-bool.php is_bool

func IsDouble

func IsDouble(v interface{}) bool

https://www.php.net/manual/zh/function.is-double.php is_double float64 float32

func IsFloat

func IsFloat(v interface{}) bool

https://www.php.net/manual/zh/function.is-float.php is_float float32

func IsInt

func IsInt(v interface{}) bool

https://www.php.net/manual/zh/function.is-int.php is_int int32

func IsInteger

func IsInteger(v interface{}) bool

https://www.php.net/manual/zh/function.is-integer.php is_integer int32

func IsReadable

func IsReadable(filename string) bool

https://www.php.net/manual/zh/function.is-readable.php is_readable()

func IsWritable

func IsWritable(filename string) bool

https://www.php.net/manual/zh/function.is-writable.php is_writable()

func Print

func Print(v ...interface{})

https://www.php.net/manual/zh/function.print.php print()

func PrintR

func PrintR(v ...interface{})

https://www.php.net/manual/zh/function.print-r.php print_r()

func Printf

func Printf(s interface{})

*

普通占位符
占位符     说明                           举例                   输出
%v      相应值的默认格式。            Printf("%v", people)   {zhangsan},
%+v     打印结构体时,会添加字段名     Printf("%+v", people)  {Name:zhangsan}
%#v     相应值的Go语法表示            Printf("#v", people)   main.Human{Name:"zhangsan"}
%T      相应值的类型的Go语法表示       Printf("%T", people)   main.Human
%%      字面上的百分号,并非值的占位符  Printf("%%")            %
布尔占位符
占位符       说明                举例                     输出
%t          true 或 false。     Printf("%t", true)       true
整数占位符
占位符     说明                                  举例                       输出
%b      二进制表示                             Printf("%b", 5)             101
%c      相应Unicode码点所表示的字符              Printf("%c", 0x4E2D)        中
%d      十进制表示                             Printf("%d", 0x12)          18
%o      八进制表示                             Printf("%d", 10)            12
%q      单引号围绕的字符字面值,由Go语法安全地转义 Printf("%q", 0x4E2D)        '中'
%x      十六进制表示,字母形式为小写 a-f         Printf("%x", 13)             d
%X      十六进制表示,字母形式为大写 A-F         Printf("%x", 13)             D
%U      Unicode格式:U+1234,等同于 "U+%04X"   Printf("%U", 0x4E2D)         U+4E2D

字符串与字节切片
占位符     说明                              举例                           输出
%s      输出字符串表示(string类型或[]byte)   Printf("%s", []byte("Go语言"))  Go语言
%q      双引号围绕的字符串,由Go语法安全地转义  Printf("%q", "Go语言")         "Go语言"
%x      十六进制,小写字母,每字节两个字符      Printf("%x", "golang")         676f6c616e67
%X      十六进制,大写字母,每字节两个字符      Printf("%X", "golang")         676F6C616E67
其它标记
占位符      说明                             举例          输出
+      总打印数值的正负号;对于%q(%+q)保证只输出ASCII编码的字符。
										   Printf("%+q", "中文")  "\u4e2d\u6587"
-      在右侧而非左侧填充空格(左对齐该区域)
#      备用格式:为八进制添加前导 0(%#o)      Printf("%#U", '中')      U+4E2D
	   为十六进制添加前导 0x(%#x)或 0X(%#X),为 %p(%#p)去掉前导 0x;
	   如果可能的话,%q(%#q)会打印原始 (即反引号围绕的)字符串;
	   如果是可打印字符,%U(%#U)会写出该字符的
	   Unicode 编码形式(如字符 x 会被打印成 U+0078 'x')。
' '    (空格)为数值中省略的正负号留出空白(% d);
	   以十六进制(% x, % X)打印字符串或切片时,在字节之间用空格隔开
0      填充前导的0而非空格;对于数字,这会将填充移到正负号之后

https://www.php.net/manual/zh/function.printf.php printf

func Rename

func Rename(oldName, newName string) bool

https://www.php.net/manual/zh/function.rename.php rename()

func Sin

func Sin(x float64) float64

https://www.php.net/manual/zh/function.sin.php 正弦函数 x float64 度数

func Sinh

func Sinh(x float64) float64

https://www.php.net/manual/zh/function.sinh.php 双曲正弦 x float64 度数

func Sort

func Sort(arr []int)

func StrRepeat

func StrRepeat(s string, multiplier int) string

https://www.php.net/manual/zh/function.str-repeat.php str-repeat

func StrReplace

func StrReplace(search, old, new string, count int) string

https://www.php.net/manual/zh/function.str-replace.php str_replace

func Stripos

func Stripos(haystack, needle string, offset int) int

https://www.php.net/manual/zh/function.stripos.php stripos 获取字符串首次出现的位置 不区分大小写

func Strpos

func Strpos(haystack, needle string, offset int) int

https://www.php.net/manual/zh/function.strpos.php strpos 获取字符串首次出现的位置 区分大小写

func Strrev

func Strrev(str string) string

https://www.php.net/manual/zh/function.strrev.php strrev 反转字符串

func Strripos

func Strripos(haystack, needle string, offset int) int

https://www.php.net/manual/zh/function.strripos.php strripos

func Strrpos

func Strrpos(haystack, needle string, offset int) int

https://www.php.net/manual/zh/function.strrpos.php strrpos

func Strstr

func Strstr(haystack, needle string) string

https://www.php.net/manual/zh/function.strstr.php strstr

func Strtr

func Strtr(haystack string, params ...interface{}) string

https://www.php.net/manual/zh/function.strtr.php strtr()

func Tan

func Tan(x float64) float64

https://www.php.net/manual/zh/function.tan.php 正切 x float64 度数

func VarDump

func VarDump(v ...interface{})

https://www.php.net/manual/zh/function.var-dump.php var_dump()

func Wordwrap

func Wordwrap(s string, width uint, br string, cut bool) string

https://www.php.net/manual/zh/function.wordwrap.php wordwrap()

Types

type ArrMap

type ArrMap map[string]interface{}

func ArrayChangeKeyCase

func ArrayChangeKeyCase(arr ArrMap, Case int) ArrMap

type ArraySlice

type ArraySlice []interface{}

func ArrayChunk

func ArrayChunk(input ArraySlice, size int) ArraySlice

实现php中的array_chunk https://www.php.net/manual/zh/function.array-chunk.php todo 没有实现array_chunk第三个参数使用

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL