函数库
基础路径
返回基础路径和可选子路径的完整路径字符串。
php
base_path(string $path = ""): string
base_path(string $path = ""): string
应用路径
返回应用程序路径和可选子路径的完整路径字符串。
php
app_path(string $path = ""): string
app_path(string $path = ""): string
数据路径
返回数据路径和可选子路径的完整路径字符串。
php
data_path(string $path = ""): string
data_path(string $path = ""): string
公共路径
返回公共路径和可选子路径的完整路径字符串。
php
public_path(string $path = ""): string
public_path(string $path = ""): string
配置路径
返回配置路径和可选子路径的完整路径字符串。
php
config_path(string $path = ""): string
config_path(string $path = ""): string
时间对象
返回一个Carbon对象,表示当前日期和时间。
php
now(): Carbon
now(): Carbon
打印变量
使用Symfony VarDumper库打印变量。
php
dux_debug(...$args): void
dux_debug(...$args): void
获取 ip
返回当前访问的IP地址。
php
get_ip()
get_ip()
精准计算
使用bc数学扩展库执行指定的数学运算,并返回结果。
php
bc_math(int|float|string $left = 0, string $symbol = '+', int|float|string $right = 0, int $default = 2): string
bc_math(int|float|string $left = 0, string $symbol = '+', int|float|string $right = 0, int $default = 2): string
精准对比
使用bc数学扩展库比较两个数的大小,返回1、0或-1。
php
bc_comp(int|float|string $left = 0, int|float|string $right = 0, int $scale = 2): int
bc_comp(int|float|string $left = 0, int|float|string $right = 0, int $scale = 2): int
字符串加密
使用openssl库对字符串进行加密,并返回加密后的十六进制字符串。
php
encryption(string $str, string $key = '', string $iv = '', $method = 'AES-256-CBC'): string
encryption(string $str, string $key = '', string $iv = '', $method = 'AES-256-CBC'): string
字符串解密
使用openssl库对加密字符串进行解密,并返回解密后的原始字符串。
php
decryption(string $str, string $key = '', string $iv = '', $method = 'AES-256-CBC'): string
decryption(string $str, string $key = '', string $iv = '', $method = 'AES-256-CBC'): string