ADMIN_COOKIE_NAME
public
mixed
ADMIN_COOKIE_NAME
= 'user_id'
public
mixed
ADMIN_COOKIE_NAME
= 'user_id'
public
mixed
ADMIN_DIR_NAME
= 'admin'
public
mixed
DS
= \DIRECTORY_SEPARATOR
public
mixed
HELPER_DIR
= __DIR__
主要服务于后台管理员
auth_login_url() : mixed
是否是超及管理员,就是用户ID为1的
is_admin() : mixed
是否是登录会员
is_logined() : mixed
获取登录者id,包含平台COOKIE以及小程序token登录的
get_admin_id() : mixed
判断是否是超管,不是显示错误
is_admin_with_error() : mixed
接口判断是否是管理员登录
api_is_admin() : mixed
判断后台是否登录
check_admin_login([mixed $url = '' ]) : mixed
已登录用户ID
logined_user_id() : mixed
是否有权限
has_access(mixed $key) : mixed
是否有权限,无权限抛出异常
access(mixed $name[, mixed $ret = false ]) : mixed
get_user_acl() : mixed
是否有权限,无权限返回false
if_access(mixed $name) : mixed
判断有其中一个权限
if_access_or(mixed $str) : mixed
解析do_action
parse_action(mixed $li[, mixed $preg = 'do_action' ]) : mixed
所有会员
get_user_all([mixed $where = [] ]) : mixed
根据用户id查用户信息
get_user(mixed $user_id[, mixed $fields = [] ]) : mixed
查用户信息,where条件
get_user_where([mixed $where = [] ]) : mixed
取用户扩展字段值
get_user_meta_where([mixed $where = [] ][, mixed $return_row = false ]) : mixed
取用户扩展字段值
get_user_meta(mixed $user_id) : mixed
更新用户的meta信息
set_user_meta(mixed $user_id, array<string|int, mixed> $meta) : mixed
['nickname'=>'']
更新用户信息
set_user(mixed $user_id[, mixed $data = [] ]) : mixed
user_group_tree([mixed $id = null ]) : mixed
取单个用户组信息
user_group_get(mixed $group_id) : mixed
创建或更新用户
admin_user(mixed $user, mixed $pwd, mixed $tag) : mixed
get_captcha_drive() : mixed
get_captcha_check([mixed $ignore_expire = false ]) : mixed
get_captcha_init([mixed $output = true ]) : mixed
_app_check_plugin(mixed $plugin_name[, mixed $plugin_dir = 'plugins' ]) : mixed
尝试多次运行 $times 运行次数 $usleep_time 毫秒
call_retry(mixed $func[, mixed $times = 3 ][, mixed $usleep_time = 1000 ]) : mixed
数组转tree
array_to_tree(mixed $list[, mixed $pk = 'id' ][, mixed $pid = 'pid' ][, mixed $child = 'children' ][, mixed $root = 0 ][, mixed $my_id = '' ]) : mixed
输入$list [ {id:1,pid:0,其他字段}, {id:2,pid:1,其他字段}, {id:3,pid:1,其他字段}, ] 输出 [ [ id:1, pid:0, 其他字段, children:[ {id:2,pid:1,其他字段}, {id:3,pid:1,其他字段}, ] ] ]
数组或字符输出,方便查看
pr(mixed $str) : mixed
add_action(mixed $name, mixed $call[, mixed $level = 20 ]) : mixed
do_action(mixed $name[, mixed &$par = null ]) : mixed
自动加载include.php
auto_include() : mixed
_auto_include(mixed $dir_name) : mixed
自动加载router.php
auto_include_router() : mixed
_auto_include_router(mixed $dir_name) : mixed
自动加载主题
autoload_theme([mixed $name = "front" ]) : mixed
跳转
jump(string $url) : void
static_url() : mixed
cdn() : mixed
json(mixed $data) : mixed
域名
host() : mixed
判断是命令行下
is_cli() : mixed
是否是POST请求
is_post() : mixed
is_json(mixed $data[, mixed $assoc = false ]) : mixed
加载css
css(mixed $file[, mixed $is_output = true ]) : mixed
add_css_file(mixed $file) : mixed
js(mixed $file[, mixed $is_output = true ]) : mixed
add_js_file(mixed $file) : mixed
数组转对象
array_to_object(array<string|int, mixed> $arr) : object
数组
对象转数组
object_to_array(object $obj) : array<string|int, mixed>
对象
取目录名
get_dir(string $name) : void
取后缀
get_ext(string $name) : void
取文件名
get_name(string $name) : void
创建目录
create_dir_if_not_exists(mixed $arr) : mixed
是否是本地环境
is_local() : bool
取IP
get_ip([mixed $type = 0 ][, mixed $adv = false ]) : mixed
当前时间
now() : mixed
计算两点地理坐标之间的距离
get_distance(Decimal $longitude1, Decimal $latitude1, Decimal $longitude2, Decimal $latitude2[, int $unit = 2 ][, int $decimal = 2 ]) : Decimal
起点经度
起点纬度
终点经度
终点纬度
单位 1:米 2:公里
精度 保留小数位数
is_ssl() : mixed
cookie(mixed $name[, mixed $value = '' ][, mixed $expire = 0 ]) : mixed
cookie_delete(mixed $name) : mixed
remove_cookie(mixed $name) : mixed
date_limit() : mixed
路径列表,支持文件夹下的子所有文件夹
get_deep_dir(string $path) : void
el_size() : mixed
显示2位小数
price_format(mixed $yuan[, mixed $dot = 2 ]) : mixed
返回错误信息,JSON格式
json_error([mixed $arr = [] ][, mixed $is_array = false ]) : mixed
array_error([mixed $arr = [] ]) : mixed
返回成功信息,JSON格式
json_success([mixed $arr = [] ][, mixed $is_array = false ]) : mixed
array_success([mixed $arr = [] ]) : mixed
yaml转数组
yaml_load(string $str) : array<string|int, mixed>
数组转yaml
yaml_dump(array<string|int, mixed> $array[, int $line = 3 ]) : string
yaml转数组,数组转yaml格式
yaml(string $str) : string|array<string|int, mixed>
validate(mixed $labels, mixed $data, mixed $rules[, mixed $show_array = false ]) : mixed
取文件信息
get_file(mixed $id) : mixed
get_theme([mixed $theme_type = 'front' ]) : mixed
view(mixed $name[, mixed $params = [] ]) : mixed
设置配置
set_config(mixed $title, mixed $body[, mixed $shop_id = '' ]) : mixed
优先取数据库,未找到后取配置文件
get_config(mixed $title[, mixed $shop_id = '' ]) : mixed
elementui table序号
element_index_method() : string
每页显示多少条记录
page_size(mixed $name) : mixed
显示下拉选择分页每页显示多少条
page_size_array() : mixed
前台主题url
theme_url() : mixed
设置前台主题
set_theme(mixed $name) : mixed
设置后台主题
set_admin_theme(mixed $name) : mixed
后台主题url
admin_theme_url() : mixed
aes_encode(mixed $data[, mixed $key = '' ][, mixed $iv = '' ][, mixed $type = 'AES-128-CBC' ][, mixed $options = '' ]) : mixed
aes_decode(mixed $data[, mixed $key = '' ][, mixed $iv = '' ][, mixed $type = 'AES-128-CBC' ][, mixed $options = '' ]) : mixed
el_page_sizes() : mixed
lang(mixed $name[, mixed $val = [] ][, mixed $pre = 'app' ]) : mixed
搜索替换\n , ,空格
string_to_array(string $name[, mixed $array = '' ]) : array<string|int, mixed>
返回两个时间点间的日期数组
get_dates(string $start, string $end) : void
时间格式 Y-m-d
时间格式 Y-m-d
当前时间是周几
get_date_china(mixed $date) : mixed
多少时间之前
timeago(mixed $time) : mixed
is_ajax() : mixed
防止重复执行
cli_prevent_duplication(mixed $argv[, mixed $cmd = 'php cmd.php' ]) : mixed
包含文件
import(mixed $file[, mixed $vars = [] ][, mixed $check_vars = false ]) : mixed
生成表单TOKEN,防止重复提交
create_form_token() : mixed
检测表单TOKEN
check_form_token([mixed $token = '' ]) : mixed
//检测form_token check_form_token(g('form_token'));
检测reffer是否正常,如异常返回JSON
check_reffer_with_json([mixed $allow_domain = [] ][, mixed $is_root = true ]) : mixed
检测reffer
check_reffer([mixed $allow_domain = [] ][, mixed $is_root = true ]) : mixed
取reffer
get_reffer([mixed $refer = '' ]) : mixed
取主域名,如 admin.baidu.com返回baidu.com
get_root_domain([mixed $host = '' ]) : mixed
取子域名,如admin.baidu.com返回admin
get_sub_domain([mixed $host = '' ]) : mixed
admin_header() : mixed
admin_footer() : mixed
格式化金额
format_money(mixed $money[, mixed $len = 2 ][, mixed $sign = '¥' ]) : mixed
生成签名链接
create_sample_sign_url([mixed $arr = [] ]) : mixed
验证签名链接是否可用
verify_sample_sign_url([mixed $exp_time = 60 ]) : mixed
检查签名防止篡改
signature_checker([mixed $secret = '' ][, mixed $array_encode = false ]) : mixed
生成签名 签名生成的通用步骤如下: 第一步:将参与签名的参数按照键值(key)进行字典排序 第二步:将排序过后的参数,进行key和value字符串拼接 第三步:将拼接后的字符串首尾加上app_secret秘钥,合成签名字符串 第四步:对签名字符串进行MD5加密,生成32位的字符串 第五步:将签名生成的32位字符串转换为大写
sign_by_secret(mixed $params[, mixed $secret = '' ][, mixed $array_encode = false ]) : mixed
多语言
set_lang([mixed $lang = 'zh-cn' ]) : mixed
生成URL
create_url(mixed $url) : mixed
清空BLOCK
block_clean() : mixed
BLOCK开始
block_start(mixed $name) : mixed
BLOCK结束
block_end([mixed $is_muit = false ]) : mixed
获取BLOCK
get_block([mixed $name = '' ]) : mixed
自动加载app目录下控制器及方法 page_not_find() 定义错误页面 $autoload->addPsr4('app\\',PATH.'app/'); $router->set404(function() { auto_load_app_router(['app','']); });
auto_load_app_router([mixed $pre_name_arr = [] ]) : mixed
所本地文件解压到指定目录
zip_extract(mixed $local_file, mixed $extract_local_dir) : mixed
生成ZIP
zip_create( $local_zip_file[, $files = [] ]) : mixed
获取本地include文件内容
get_include_content(mixed $local_file) : mixed
返回当前版本号
get_version() : mixed
避免重复调用 get_ins('key',function(){ my_function(); });
get_ins(mixed $key, mixed $call) : mixed
判断是JSON请求
is_json_request() : mixed
输出HTML错误页面
html_error(mixed $all) : mixed
数组转el-select
array_to_el_select(mixed $all, mixed $v, mixed $k) : mixed
传入带http的URL返回 uploads/...这种类型的URL
get_upload_url(mixed $f) : mixed
添加JS
add_js(mixed $code) : mixed
输出JS
render_js() : mixed
输出JS文件
render_js_file() : mixed
添加JS
add_css(mixed $code) : mixed
输出JS
render_css() : mixed
输出css文件
render_css_file() : mixed
生成图表 https://echarts.apache.org/handbook/zh/how-to/chart-types/line/area-line
echats(mixed $ele[, mixed $options = [] ]) : mixed
echats(['id'=>'main1','width'=>600,'height'=>400],[ 'title'=>[ 'text'=>'ECharts 入门示例' ], 'yAxis'=>"js:}", 'legend'=>[ 'data'=>['销量'] ], 'xAxis'=>[ 'data'=>['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子'] ], 'series'=>[ [ 'name'=>'销量', 'type'=>'bar', 'data'=>[5, 20, 36, 10, 10, 20] ] ] ]);
echats_reload() : mixed
echarts(mixed $ele[, mixed $options = [] ]) : mixed
echarts_reload() : mixed
缓存删除
cache_delete(mixed $key) : mixed
缓存设置|获取 需要删除时可用 cache($key,null) 删除
cache(mixed $key[, mixed $data = '' ][, mixed $second = null ]) : mixed
依赖缓存 $data = cache_node('tree',[ 'table' => $this->table, 'field' => 'updated_at' ],function(){ return $this->_tree(); });
cache_node(mixed $key, mixed $arr, mixed $call) : mixed
对一行记录做缓存 $data = cache_node_id($this->table,1,function(){ return db_get_one($this->table,'*',['id'=>1]); });
cache_node_id(mixed $table, mixed $nid, mixed $call[, mixed $auto_update_cache = true ]) : mixed
image_resize(mixed $local_url, mixed $w[, mixed $h = null ]) : mixed
使用本地PHP GD生成 https://image.intervention.io/v2/usage/overview#basic-usage
image_resize_local(mixed $local_url, mixed $w[, mixed $h = NULL ]) : mixed
配置 image_drive 值为imagick ,默认不用配置使用的gd
image_init() : mixed
获取checkbox选中数组 jquery_checkbox_get_active('search','search') <input type="checkbox" name="search" :value="k">
jquery_checkbox_get_active(mixed $var) : mixed
checkbox全选|全不选
jquery_checkbox_select_all(mixed $name) : mixed
返回接口AUTHORIZATION解密后数组 返回{user_id:'',time:int}
api([mixed $show_error = true ]) : mixed
接口是否是管理员
api_admin() : mixed
解析 HTTP_AUTHORIZATION
get_author([mixed $sign = null ][, mixed $ignore_time_check = false ][, mixed $show_error = true ]) : mixed
写日志
log_info(mixed $str[, mixed $name = 'app' ][, mixed $type = 'info' ]) : mixed
记录错误日志
log_error(mixed $str) : mixed
初始化
log_init([mixed $channel_name = 'app' ]) : mixed
取本地插件
local_plugin() : mixed
获取插件列表
_local_plugin([mixed $dir_name = 'plugins' ]) : mixed
执行插件目录下SQL文件
run_plugin_sql([mixed $plugins_dir = 'plugins' ][, mixed $plugin_name = '' ]) : mixed
安装插件
install_plugin(mixed $name) : mixed
安装或卸载插件
install_plugin_auto(mixed $plugin_name) : mixed
卸载插件
remove_plugin(mixed $name) : mixed
加载插件到数据库
load_plugin_to_db() : mixed
卸载插件
do_remove_plugin(mixed $plugin_name) : mixed
执行安装具体的插件
do_install_plugin(mixed $plugin_name[, mixed $support_remove = false ][, mixed $has_status = null ]) : mixed
已安装插件
has_actived_plugin() : mixed
添加xss过滤
get_xss_clean_ins() : mixed
防止xss
xss_clean_str(mixed $str) : mixed
防止xss
xss_clean(mixed $input) : mixed
global_trim() : mixed
global_trim_inner(mixed &$in) : mixed
取GET
get([mixed $key = "" ]) : mixed
取POST
post([mixed $key = "" ]) : mixed
取POST值
get_post([mixed $key = "" ]) : mixed
g([mixed $key = null ]) : mixed
取php://input值
get_input() : mixed
取当前URL完整地址
get_full_url([mixed $with_http = false ]) : mixed
CURL请求
guzzle_http([mixed $click_option = [] ]) : mixed
GET $client = guzzle_http(); $res = $client->request('GET', $url); return (string)$res->getBody();
PUT $body = file_get_contents($local_file); $request = new \GuzzleHttp\Psr7\Request('PUT', $upload_url, $headers=[], $body); $response = $client->send($request, ['timeout' => 30]); if($response->getStatusCode() == 200){ return true; }
POST $res = $client->request('POST', $url,['body'=>]);
return (string)$res->getBody();
JSON
$res = $client->request('POST', '/json.php', [ 'json' => ['foo' => 'bar'] ]);
发送application/x-www-form-urlencoded POST请求需要你传入form_params
$res = $client->request('POST', $url, [ 'form_params' => [ 'field_name' => 'abc', 'other_field' => '123', 'nested_field' => [ 'nested' => 'hello' ] ] ]);
guzzle_http_fake_option() : mixed
从文件中安装SQL install_sql_from_file(local_sql_file,function($sql){ $db->query($sql); })
install_sql_from_file(mixed $file, mixed $call) : mixed
install_sql_get_next(mixed $fp) : mixed
数据库结构比较并生成差量SQL
create_db_compare_sql(mixed $db_compare_config[, mixed $need_compare_dbs = [] ][, mixed $is_like = false ]) : mixed
主库信息
db_compare_main([ $db_compare_config = [] ]) : mixed
db_compare_field_append(mixed $vv) : mixed
需要同步的数据库
db_compare_sync(mixed $db_compare_config[, mixed $sync_tables = [] ]) : mixed
需要同步的数据库
db_compare_sync_like(mixed $db_compare_config[, mixed $need_sync_dbs = [] ]) : mixed
比较两个数据库结构
db_compare_create_sync_sql(mixed $struct_1, mixed $struct_2, mixed $struct_2_db) : mixed
激活平台数据库连接,平台数据库不支持从库读
db_active_main() : mixed
激活读数据库连接
db_active_read() : mixed
激活默认数据库连接
db_active_default() : mixed
表前缀
db_prefix([mixed $prefix = null ]) : mixed
表名
get_db_table_name(mixed $table) : mixed
激活当前使用哪个数据库
db_active([mixed $name = 'default' ][, mixed $need_rollback_here = false ]) : mixed
回到上一个连接
db_active_rollback() : mixed
获取当前启用的数据库连接
get_db_active_name() : mixed
判断是否可运行action
db_can_run_action() : mixed
数据库是否可执行更新操作
db_can_run_update([mixed $sql = '' ]) : mixed
连接数据库
new_db([mixed $config = [] ][, mixed $name = '' ]) : mixed
数据库实例
medoo_db() : object
db() : mixed
db_pager(mixed $table, mixed $join[, mixed $columns = null ][, mixed $where = null ]) : mixed
设置分页总记录数 一般情况用不到
db_pager_count([mixed $nums = null ]) : mixed
显示分页 调用db_pager后,再调用。 db_pager_html([ 'url'=>'', ]);
db_pager_html([mixed $arr = [] ]) : mixed
添加错误信息
db_add_error(mixed $str) : mixed
获取错误信息
db_get_error() : mixed
db_get_fast(mixed $table[, mixed $join = null ][, mixed $columns = null ][, mixed $where = null ]) : mixed
db_get(mixed $table[, mixed $join = null ][, mixed $columns = null ][, mixed $where = null ]) : mixed
$lists = db_select('do_order', [ 'count' => 'COUNT(`id`)', 'total' => 'SUM(`total_fee`)', 'date' => "FROM_UNIXTIME(`inserttime`, '%Y-%m-%d')" ], 'WHERE `status` = 1 GROUP BY `date` LIMIT 30' );
db_select(mixed $table[, mixed $join = "*" ][, mixed $columns = null ][, mixed $where = null ]) : mixed
写入记录
db_insert(string $table[, array<string|int, mixed> $data = [] ][, mixed $don_run_action = false ]) : array<string|int, mixed>
表名
数据
更新记录
db_update(string $table[, array<string|int, mixed> $data = [] ][, mixed $where = [] ][, mixed $don_run_action = false ]) : array<string|int, mixed>
表名
数据
数据库事务
db_action(mixed $call) : mixed
对数据进行
db_for_update(mixed $table, mixed $id) : mixed
根据表名、字段 、条件 查寻一条记录
db_get_one(string $table[, mixed $join = "*" ][, mixed $columns = null ][, array<string|int, mixed> $where = null ]) : array<string|int, mixed>
表名
条件
SQL查寻
db_query(mixed $sql[, mixed $raw = null ]) : mixed
取最小值 https://medoo.in/api/min min($table, $column, $where) min($table, $join, $column, $where)
db_get_min(string $table[, mixed $join = "*" ][, string $column = null ][, array<string|int, mixed> $where = null ]) : void
表名
字段
条件
取最大值 max($table, $column, $where) max($table, $join, $column, $where)
db_get_max(string $table[, mixed $join = "*" ][, string $column = null ][, array<string|int, mixed> $where = null ]) : void
表名
字段
条件
总数 count($table, $where) count($table, $join, $column, $where)
db_get_count(string $table[, mixed $join = "*" ][, mixed $column = null ][, array<string|int, mixed> $where = null ]) : void
表名
条件
是否有记录 has($table, $where) has($table, $join, $where)
db_get_has(string $table[, mixed $join = null ][, array<string|int, mixed> $where = null ]) : void
表名
条件
随机取多条记录 rand($table, $column, $where) rand($table, $join, $column, $where)
db_get_rand(string $table[, mixed $join = "*" ][, string $column = null ][, array<string|int, mixed> $where = null ]) : void
表名
字段
条件
取总和 sum($table, $column, $where) sum($table, $join, $column, $where)
db_get_sum(string $table[, mixed $join = "*" ][, string $column = null ][, array<string|int, mixed> $where = null ]) : void
表名
字段
条件
取平均值 avg($table, $column, $where) avg($table, $join, $column, $where)
db_get_avg(string $table[, mixed $join = "*" ][, string $column = null ][, array<string|int, mixed> $where = null ]) : void
表名
字段
条件
RAW https://medoo.in/api/raw raw('NOW()') raw('RAND()') raw('AVG(<age>)')
db_raw(string $raw) : mixed
db_del(mixed $table, mixed $where) : mixed
db_delete(mixed $table, mixed $where) : mixed
显示所有表名
show_tables(string $table) : void
表名
取表中字段
get_table_fields(mixed $table[, mixed $has_key = true ]) : mixed
返回数据库允许的数据,传入其他字段自动忽略
db_allow(mixed $table, mixed $data) : mixed
显示数据库表结构,支持markdown格式
database_tables([string $name = null ][, mixed $show_markdown = false ]) : mixed
数据库名
取表中json字段
get_table_field_json(mixed $table) : mixed
判断表中的字段是不是json
get_table_field_is_json(mixed $table, mixed $field) : mixed
把数据库中json字段转成array
db_row_json_to_array( $table_name[, &$row_data = [] ]) : mixed
array_order_by() : mixed
is_json(mixed $data[, mixed $assoc = false ]) : mixed
add_action(mixed $name, mixed $call[, mixed $level = 20 ]) : mixed
do_action(mixed $name[, mixed &$par = null ]) : mixed
返回两个日期之间 $date1 = '2022-11-01'; $date2 = '2022-12-14'; 字段是datetime类型
db_between_date(mixed $field, mixed $date1, mixed $date2) : mixed
返回两个月份之间 $date1 = '2022-11'; $date2 = '2022-12'; 字段是datetime类型
db_between_month(mixed $field, mixed $date1, mixed $date2) : mixed
跨库数据库事务
xa_db_action([mixed $key_call = [] ]) : mixed
创建分区表,自动排除已有的
db_struct_table_range_auto(mixed $db_name, mixed $table[, mixed $year_month = [] ][, mixed $datetime_field = 'created_at' ][, mixed $name = 'p' ]) : mixed
db_struct_table_range_auto('wordpress','my_table',[ '2023-11', '2023-12', '2024-01', '2024-02', '2024-03', ]);
创建分区表,内部调用 db_struct_table_range('my_table',[ '2023-11', '2023-12', '2024-01', ],'created_at','p',false);
db_struct_table_range(mixed $table[, mixed $year_month = [] ][, mixed $datetime_field = 'created_at' ][, mixed $name = 'p' ][, mixed $return_sql = false ]) : mixed
分区表名称
db_struct_show_range([mixed $db_name = '' ][, mixed $table = '' ]) : mixed
删除某个分区表 删除后分区数据也会一起删除
drop_struct_range(mixed $table, mixed $p) : mixed
显示create table语句
db_show_create_table(mixed $table[, mixed $return_val = true ]) : mixed
get_device_info() : mixed
redis
predis([mixed $host = '' ][, mixed $port = '' ][, mixed $auth = '' ]) : mixed
添加位置信息 predis_add_geo('places',[ [ 'lng'=>'116.397128', 'lat'=>'39.916527', 'title'=>'北京天安门' ], ]);
predis_add_geo(mixed $key[, mixed $arr = [] ]) : mixed
删除位置信息
predis_delete_geo(mixed $key[, mixed $arr = [] ]) : mixed
predis_delete_geo('places',[ '北京天安门', ]);
返回附近的地理位置 pr(predis_get_pager('places', 116.403958, 39.915049)); http://redisdoc.com/geo/georadius.html
predis_get_pager(mixed $key, mixed $lat, mixed $lng[, mixed $juli = 2 ][, mixed $sort = 'ASC' ][, mixed $to_fixed = 2 ]) : mixed
取lat lng
predis_geo_pos(mixed $key[, mixed $title = [] ][, mixed $to_fixed = 6 ]) : mixed
分组分页
array_to_pager(mixed $arr) : mixed
返回URL路径,不含有域名部分
get_url_remove_http(mixed $url) : mixed
取后缀
get_ext_by_url(mixed $url) : mixed
取mime
get_mime(mixed $url) : mixed
获取远程URL内容
get_remote_file(mixed $url[, mixed $is_json = false ]) : mixed
下载文件 建议使用 download_file_safe
download_file(mixed $url[, mixed $contain_http = false ]) : mixed
下载资源文件到本地
download_file_safe(mixed $url[, mixed $mimes = ['image/*', 'video/*'] ][, mixed $cons = [] ][, mixed $contain_http = false ]) : mixed
下载远程文件 global $remote_to_local_path; $remote_to_local_path = '/uploads/saved/'.date("Y-m-d");
download_remote_file(mixed $url[, mixed $path = '' ][, mixed $name = '' ]) : mixed
调用阿里云
curl_aliyun(mixed $url[, mixed $bodys = '' ][, mixed $method = 'POST' ]) : mixed
返回成功的json信息
success_data(mixed $data[, mixed $msg = '' ]) : mixed
返回失败的json信息
error_data(mixed $msg) : mixed
pathinfo /index.php/admin/auth/index?code=2 返回 admin/auth/index 数组时返回 ['admin','auth','index']
get_path_info([mixed $return_array = false ]) : mixed
支持pathinfo路由 未找到请用 pathinfo_not_find 函数
router_pathinfo([mixed $ns = 'app' ][, mixed $add_controller = 'controller' ][, mixed $ucfirst_controller = true ]) : mixed
生成数字随机数 一般用于核销 需要表名 rand_code 字段 nid code status默认0
make_rand_code(mixed $node_id) : mixed
核销后需要释放核销码
update_make_rand_code(mixed $node_id) : mixed
锁功能已替代 lock_call('k',functon(){
set_lock(mixed $key[, mixed $exp_time = 60 ]) : mixed
},second);
获取是否锁定
get_lock(mixed $key) : mixed
释放锁定
del_lock(mixed $key) : mixed
json数据替换
json_replace( $json[, $replace = [] ][, $return_json = true ]) : mixed
去除PHP代码注释
remove_php_notes(mixed $content) : mixed
在线查看office文件
online_view_office(mixed $url) : mixed
格式化输出金额 强制输出数字类型
printfs(mixed &$v[, mixed $keys = [] ][, mixed $dot = 2 ]) : mixed
float不进位,如3.145 返回3.14 进位的有默认round(3.145) 或sprintf("%.2f",3.145);
float_noup(mixed $float_number[, mixed $dot = 2 ]) : mixed
四舍五入
float_up(mixed $float_number[, mixed $dot = 2 ][, $mid_val = 5 ]) : mixed
加载xlsx load_xls([ 'file' => $xls, 'config'=>[ '序号' =>'index', ], 'title_line'=>1, 'call'=>function($i,$row,&$d){} ]);
load_xls([mixed $new_arr = [] ]) : mixed
获取文件行数,不包空行
get_lines(mixed $file[, mixed $length = 40960 ]) : mixed
返回请求中是http还是https
get_request_top() : mixed
返回请求域名及URL部分,不包含http://
get_request_host() : mixed
自动跳转到https网站
auto_jump() : mixed
get_http_full_url(mixed $url[, mixed $fun = 'cdn_url' ]) : mixed
从数组中搜索
get_index_array_valule(mixed $array, mixed $key, mixed $val) : mixed
gbk_substr(mixed $text, mixed $start, mixed $len[, mixed $gbk = 'GBK' ]) : mixed
GBK长宽 2个字符
get_gbk_len(mixed $value[, mixed $gbk = 'GBK' ]) : mixed
文字居中
get_text_c(string $str, int $len) : mixed
文字排版 左 中 右 左 右
get_text_lr(array<string|int, mixed> $arr, int $length[, mixed $return_arr = false ]) : mixed
处理跨域
allow_cross_origin() : mixed
to_utf8(mixed $str) : mixed
csv_reader(mixed $file) : mixed
csv_writer(mixed $file[, mixed $header = [] ][, mixed $content = [] ]) : mixed
基于redis锁
lock_call(mixed $key, mixed $call[, mixed $time = 10 ]) : mixed
global $redis_lock; //锁前缀 global $lock_key;
$redis_lock = [ 'host'=>'', 'port'=>'', 'auth'=>'', ];
lock_call('k',functon()},1); 或 if(lock_start('k')){ .. lock_end(); }
开始锁
lock_start(mixed $key[, mixed $time = 1 ]) : mixed
释放锁
lock_end() : mixed
compare_date(mixed $a, mixed $b) : mixed
发布消息 redis_pub("demo","welcome man"); redis_pub("demo",['title'=>'yourname']);
redis_pub(mixed $channel, mixed $message) : mixed
取订阅消息 redis_sub("demo",function($channel,$message){ echo "channel ".$channel."\n"; print_r($message); });
redis_sub(mixed $channel, mixed $call[, mixed $unsubscribe = false ]) : mixed
send_pusher([mixed $data = [] ][, mixed $channel = 'netteadmin' ][, mixed $event = 'notice' ]) : mixed
think_check_sign(mixed $json_string[, mixed $key = '' ][, mixed $sign_key = 'sign' ]) : mixed
think_create_sign([mixed $arr = [] ][, mixed $key = '' ]) : mixed
get_str_ord(mixed $str[, mixed $is_join = false ]) : mixed
gz_encode(mixed $arr_or_str) : mixed
gz_decode(mixed $str) : mixed
html_to_pdf(mixed $input_html_file, mixed $output_pdf_file[, mixed $return_cmd = false ][, mixed $exec = false ]) : mixed
https://github.com/picqer/php-barcode-generator/blob/main/src/BarcodeGenerator.php C128 C128A C128B C128C C93 EAN13 EAN8 EAN2
get_barcode(mixed $code[, mixed $type = 'C128' ][, mixed $widthFactor = 2 ][, mixed $height = 30 ][, mixed $foregroundColor = [0, 0, 0] ]) : mixed
text_add_br(mixed $text, mixed $w[, mixed $br = '<br>' ]) : mixed
get_server_headers([mixed $name = '' ]) : mixed
output_js_css([mixed $js = '' ][, mixed $css = '' ]) : mixed
xml2array(mixed $xml) : mixed
array2xml(mixed $arr[, mixed $root = '' ]) : mixed
copy_base64_data() : mixed
set_scss_path(mixed $path) : mixed
scss(mixed $css[, mixed $is_cached = false ]) : mixed
HTML端收消息 wss://yourdomain/wss ws://ip:port
get_ws_js(mixed $func[, mixed $ws = 'ws://127.0.0.1:3006' ]) : mixed
生成node js ws服务 需要把返回的内容写入server.js中 依赖 ioredis
create_node_ws_server([mixed $ws_port = 3006 ][, mixed $topic = ['demo'] ][, mixed $redis_host = '127.0.0.1' ][, mixed $port = '6379' ][, mixed $auth = '' ]) : mixed
xis_ssl() : mixed
xcookie(mixed $name[, mixed $value = '' ][, mixed $expire = 0 ]) : mixed
xcookie_delete(mixed $name) : mixed
根据公钥生成文件
license_create(mixed $data[, mixed $file = null ]) : mixed
获取授权信息
license_data([mixed $file = '' ]) : mixed
license_data_parse(mixed &$data) : mixed
授权是否过期
license_is_expire() : bool
授权是否接近过期
license_near_expire() : void
license_html() : mixed
rpc_client(mixed $url[, mixed $is_remote = false ]) : mixed
rpc_server(mixed $class) : mixed
rpc_token() : mixed
向角色中添加权限名 url_acl_add_auth("管理员",'产品'); url_acl_add_auth("管理员",['产品','产品列表']);
url_acl_add_auth(mixed $auth_name, mixed $acl_title) : mixed
检测角色是否有权限
url_acl(mixed $auth_name) : mixed
取角色有的权限 返回可以访问的URL
get_url_acl_auth_urls(mixed $auth_name) : mixed
取角色拥有的ACL名称
get_url_acl_auth_name(mixed $auth_name) : mixed
把URL添加到权限中
url_acl_add(mixed $title, mixed $url) : mixed
取请求URL,不包含?
get_url_acl_request_uri() : mixed
权限列表
get_url_acl() : mixed
季度 返回 k=>{0:开始 1:结束 flag:}
vue_get_jidu([mixed $time = '' ]) : mixed
每个季度开始、结束时间
vue_get_jidu_array(mixed $year) : mixed
某月的最后一天
vue_get_last_day([mixed $month = '2023-07' ]) : mixed
vue message
vue_message() : mixed
loading效果
vue_loading([mixed $name = 'load' ][, mixed $txt = '加载中' ]) : mixed
Encodes a PHP variable into javascript representation.
php_to_js(mixed $value[, bool $safe = false ]) : string
Example:
$options=array('key1'=>true,'key2'=>123,'key3'=>'value'); echo php_to_js($options); // The following javascript code would be generated: // {'key1':true,'key2':123,'key3':'value'}
For highly complex data structures use and to serialize and unserialize.
If you are encoding user input, make sure $safe is set to true.
PHP variable to be encoded
If true, 'js:' will not be allowed. In case of wrapping code with JavaScript expression will stay as is no matter what value this parameter is set to. Default is false. This parameter is available since 1.1.11.
the encoded string
yii_quote(mixed $js[, mixed $forUrl = false ]) : mixed