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