常用函数

基础路径

返回基础路径和可选子路径的完整路径字符串。

base_path(string $path = ""): string

应用路径

返回应用程序路径和可选子路径的完整路径字符串。

app_path(string $path = ""): string

数据路径

返回数据路径和可选子路径的完整路径字符串。

data_path(string $path = ""): string

公共路径

返回公共路径和可选子路径的完整路径字符串。

public_path(string $path = ""): string

配置路径

返回配置路径和可选子路径的完整路径字符串。

config_path(string $path = ""): string

时间对象

返回一个Carbon对象,表示当前日期和时间。

now(): Carbon

打印变量

使用Symfony VarDumper库打印变量。

dux_debug(...$args): void

获取 ip

返回当前访问的IP地址。

get_ip()

精准计算

使用bc数学扩展库执行指定的数学运算,并返回结果。

bc_math(int|float|string $left = 0, string $symbol = '+', int|float|string $right = 0, int $default = 2): string

精准对比

使用bc数学扩展库比较两个数的大小,返回1、0或-1。

bc_comp(int|float|string $left = 0, int|float|string $right = 0, int $scale = 2): int

字符串加密

使用openssl库对字符串进行加密,并返回加密后的十六进制字符串。

encryption(string $str, string $key = '', string $iv = '', $method = 'AES-256-CBC'): string

字符串解密

使用openssl库对加密字符串进行解密,并返回解密后的原始字符串。

decryption(string $str, string $key = '', string $iv = '', $method = 'AES-256-CBC'): string