189 8069 5689

Golang如何封装PHP常用函数

本文小编为大家详细介绍“Golang如何封装PHP常用函数”,内容详细,步骤清晰,细节处理妥当,希望这篇“Golang如何封装PHP常用函数”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。

创新互联提供高防服务器、云服务器、香港服务器、多线服务器托管

go-to-php

用Golang封装PHP常用的函数,为了区分PHP与Go中的函数,go-to-php封装的函数,都是在对应的PHP函数的前面加上大写的PPallord函数除外。相关代码点击github(https://github.com/Echo-Mr-Pengw/go-to-php)

安装
  • 字符串相关包

go get -u github.com/Echo-Mr-Pengw/go-to-php/str

  • 数组相关包

开发中

.......

字符串相关函数
go-to-php封装函数对应的PHP函数
Pimplode(glue string , pieces interface{})  stringimplode
Pjoin(glue string , pieces interface{})  stringimplode的别名,同Pimplode
Pexplode(delimiter , str string , limit int) []stringexplode
Pstrlen(str string) intstrlen
Pmb_strlen(str string) intmb_strlen
Plcfirst(str string) stringlcfirst
Pucfirst(str string) stringucfirst
Pstrtoupper(str string) stringstrtoupper
Pstrtolower(str string) stringstrtolower
Pucword(str string) stringucword
Ptrim(str , character_mask string) stringtrim
Pltrim(str , character_mask string) stringltrim
Prtrim(str , character_mask string) stringrtrim
Pchop(str , character_mask string) stringrtrim的别名,同Prtrim
Pmd5(str string) stringmd5
Psha1(str string) stringsha1
Pord(str string) intord
Pallord(str string) interface{}转化全部字符,ord的升级版
Pchr(ascii int32) stringchr
Pecho(a ...interface{})echo
Pvar_dump(a ...interface{})var_dump
Pprint(a interface{})print
Pstr_repeat(input string , multiplier int) stringstr_repeat

读到这里,这篇“Golang如何封装PHP常用函数”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注创新互联行业资讯频道。


标题名称:Golang如何封装PHP常用函数
网站路径:http://cdxtjz.cn/article/pohpse.html

其他资讯