字符串函数
implode(',', $arr)
explode(',', $arr)
json_encode($arr)
json_decode($json, true)
json_encode($arr , JSON_UNESCAPED_UNICODE);
current()
is_numeric
str_replace ($find, $replace, $str)
strlen ($str)
lcfirst ($str)
intval ($str)
sprintf($str, $number)
decbin($str)
abs($str)
number_format($str, 2);
bcadd — 加法,2个任意精度数字的加法计算
bcsub — 减法
bcmul — 乘法
bcdiv — 除法
bcpow — 乘方
bcmod — 取模
bcsqrt — 求二次方根
bccomp — 比较两个任意精度的数字,返回一个整数的结果:若两数相等返回0,左数大返回1,否则返回-1
bcpowmod — 求高精度数字乘方求模,数论里非常常用
bcscale — 设置所有bc数学函数的默认小数点保留位数 — 比较两个高精度数字,返回-1, 0, 1
数组函数
array_column ($arr, $string)
array_diff ($arr1, $arr2)
array_key_exists ($key, $arr)
array_merge ($arr1, $arr2 ...)
array_flip ($arr)
array_reverse ($arr1, $arr2)
array_fill ($key, $count, $str)
array_unshift($arr, $str)
时间函数
time()
date("Y-m-d")
date("Y-m-d",strtotime("-1 day"))
date("Y-m-d",strtotime("+1 day"))
date("Y-m-d",strtotime("+3 week"))
date("Y-m-d H:i:s",strtotime("+1 week 3 days 5 hours 2 seconds"))
date("Y-m-d",strtotime("next Thursday"))
date("Y-m-d",strtotime("last Monday"))
date("Y-m-d",strtotime("last month"))
date("Y-m-d",strtotime("+1 month"))
date("Y-m-d",strtotime("+10 year"))
mktime(0, 0 , 0,date("m")-1,1,date("Y"))
mktime(23,59,59,date("m") ,0,date("Y"))
date("Y-m-d H:i:s",mktime(0, 0 , 0,date("m"),date("d")-date("w")+1-7,date("Y")))
date("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("d")-date("w")+7-7,date("Y")))
魔术方法
__construct()
__destruct()
__call()
__get()
__unset()
__toString()
__invoke()
参考链接
全局变量
$GLOBALS
$_SERVER
$_SERVER['REMOTE_ADDR']
$_SERVER['REMOTE_HOST']
$_SERVER['HTTP_HOST']
$_POST
$_GET
$_FILES
$_COOKIE
$_SESSION
参考链接
魔术常量
__LINE__
__FILE__
__DIR__
__FUNCTION__
__CLASS__
参考链接
$cmd = 'curl -X POST "http://10.21.60.166:8200/eduai_doc_v3/_refresh?username=superuser&password=YsyhLjt2020"';
exec($cmd,$result);
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律