ECShop函数列表大全

lib_time.php

gmtime()
P: 获得当前格林威治时间的时间戳 /$0
server_timezone()
P: 获得服务器的时区 /$0
local_mktime(hour=NULL,hour=NULL,minute= NULL, second=NULL,second=NULL,month = NULL,  day=NULL,day=NULL,year = NULL)
P: 生成一个用户自定义时区日期的GMT时间戳
local_date(format,format,time = NULL)
P: 将GMT时间戳格式化为用户自定义时区日期
gmstr2time($str)
P: 转换字符串形式的时间表达式为GMT时间戳
local_strtotime($str)
P: 将一个用户自定义时区的日期转为GMT时间戳
local_gettime($timestamp = NULL)
P:  获得用户所在时区指定的时间戳
local_getdate($timestamp = NULL)
P: 获得用户所在时区指定的日期和时间信息

lib_base.php
sub_str(str,str,length = 0, $append = true)
P: 截取UTF-8编码下字符串的函数
real_ip()
P: 获得用户的真实IP地址
str_len($str)
P: 计算字符串的长度(汉字按照两个字符计算)
get_crlf()
P: 获得用户操作系统的换行符
send_mail(name,name,email, subject,subject,content, type=0,type=0,notification=false)
P: 邮件发送
gd_version()
P:  获得服务器上的 GD 版本
file_get_contents($file)
P: 如果系统不存在file_get_contents函数则声明该函数
file_put_contents(file,file,data, $flags = '')
P: 如果系统不存在file_put_contents函数则声明该函数
floatval($n)
P: 如果系统不存在 floatval 函数则声明该函数
file_mode_info($file_path)
P: 文件或目录权限检查函数
log_write(arg,arg,file = '', $line = '')
P: 写入日志内容
make_dir($folder)
P: 检查目标文件夹是否存在,如果不存在则自动创建该目录
gzip_enabled()
P: 获得系统是否启用了 gzip
addslashes_deep($value)
P: 递归方式的对变量中的特殊字符进行转义
addslashes_deep_obj($obj)
P: 将对象成员变量或者数组的特殊字符进行转义
stripslashes_deep($value)
P: 递归方式的对变量中的特殊字符去除转义
make_semiangle($str)
P: 将一个字串中含有全角的数字字符、字母、空格或'%+-()'字符转换为相应半角字符
check_file_type(filename,filename,realname = '', $limit_ext_types = '')
P: 检查文件类型 /文件名/真实文件名/允许的文件类型
mysql_like_quote($str)
P: 对 MYSQL LIKE 的内容进行转义 过滤掉_ %等字符.
real_server_ip()
P: 获取服务器的ip
ecs_header(string,string,replace = true, $http_response_code = 0)
P: 自定义 header 函数,用于过滤可能出现的安全隐患
ecs_iconv(sourcelang,sourcelang,target_lang, $source_string = '')
P: 自定义的编码转换
ecs_geoip($ip)
P: 取得IP的地址,采用IP库
trim_right($str)
P: 去除字符串右侧可能出现的乱码
move_upload_file(filename,filename,target_name = '')
P: 将上传文件转移到指定位置
json_str_iconv($str)
P: 将JSON传递的参数转码
get_file_suffix(filename,filename,allow_type = array())
P: 获取文件后缀名,并判断是否合法
read_static_cache($cache_name)
P: 读结果缓存文件
write_static_cache(cachename,cachename,caches)
P: 写结果缓存文件

lib_common.php (公用函数库)
db_create_in(itemlist,itemlist,field_name = '')
P: 创建像这样的查询: "IN('a','b')" $item_list为数组
is_email($user_email)
P: 验证输入的邮件地址是否合法
is_time($time)
P: 检查是否为一个合法的时间格式
assign_query_info()
P: 获得查询时间和次数,并赋值给smarty
region_result(parent,parent,sel_name, $type)
P: 创建地区的返回信息
get_regions(type=0,type=0,parent = 0)
P: 获得指定国家的所有省份, 函数需要数据库支持.
get_shipping_config($area_id)
P: 获得配送区域中指定的配送方式的配送费用的计算参数 比如快捷公司不同.
init_users()
P: 初始化会员数据整合类
cat_list(catid=0,catid=0,selected = 0, retype=true,retype=true,level = 0, $is_show_all = true)
P: 获得指定分类下的子分类的数组, $re_type控制返回类型
cat_options(speccatid,speccatid,arr)
P: 过滤和排序所有分类,返回一个带有缩进级别的数组
load_config()
P: 载入配置信息
get_brand_list()
P: 取得品牌列表
get_brands(cat=0,cat=0,app = 'brand')
P: 获得某个分类下的品牌列表
get_promotion_info($goods_id = '')
P: 所有的促销活动信息
get_children($cat = 0)
P: 获得指定分类下所有底层分类的ID
get_article_children ($cat = 0)
P: 获得指定文章分类下所有底层分类的ID
get_mail_template($tpl_name)
P: 获取邮件模板
order_action(ordersn,ordersn,order_status, shippingstatus,shippingstatus,pay_status, note=′′,note=″,username = null)
P: 记录订单操作记录
price_format(price,price,change_price = true)
P: 格式化商品价格
get_virtual_goods(orderid,orderid,shipping = false)
P: 返回订单中的虚拟商品 记录是否发货.
virtual_goods_ship(&virtual_goods, &virtual_goods, &msg, ordersn,ordersn,return_result = false, $process = 'other')
P:  虚拟商品发货
virtual_card_shipping (goods,goods,order_sn, &msg,msg,process = 'other')
P: 虚拟卡发货
virtual_card_result(ordersn,ordersn,goods)
P: 返回虚拟卡信息
get_snatch_result($id)
P: 获取指定 id snatch 活动的结果
clear_tpl_files(iscache=true,iscache=true,ext = '')
P: 清除指定后缀的模板缓存或编译文件
clear_compiled_files($ext = '')
P: 清除模版编译文件
clear_cache_files($ext = '')
P: 清除缓存文件
clear_all_files($ext = '')
P: 清除模版编译和缓存文件
smarty_insert_scripts($args)
P: 页面上调用的js文件,组合功能.
smarty_create_pages($params)
P: 创建分页的列表
build_uri(app,app,params, append=′′,append=″,page = 0, $size = 0)
P: 重写 URL 地址
formated_weight($weight)
P: 格式化重量
log_account_change(userid,userid,user_money = 0, frozenmoney=0,frozenmoney=0,rank_points = 0, paypoints=0,paypoints=0,change_desc = '', $change_type = ACT_OTHER)
P: 记录帐户变动
article_cat_list(catid=0,catid=0,selected = 0, retype=true,retype=true,level = 0)
P: 获得指定分类下的子分类的数组/ 向下取数组.
article_cat_options(speccatid,speccatid,arr)
P: 过滤和排序所有文章分类,返回一个带有缩进级别的数组
uc_call(func,func,params=null)
P: 调用UCenter的函数
exception_handler(errno,errno,errstr, errfile,errfile,errline)
P: error_handle回调函数未启用.
get_image_path(goodsid,goodsid,image='', thumb=false,thumb=false,call='goods', $del=false)
P: 重新获得商品图片与商品相册的地址
user_uc_call(func,func,params = null)
P: 调用使用UCenter插件时的函数
get_volume_price_list(goodsid,goodsid,price_type = '1')
P: 取得商品优惠价格列表
get_final_price(goodsid,goodsid,goods_num = '1', isspecprice=false,isspecprice=false,spec = array())
P: 取得商品最终使用价格
get_package_info($id)
P: 获取指定id package 的信息
get_package_goods($package_id)
P: 获得指定礼包的商品

lib_main.php (前台公用函数库)
update_user_info()
P: 更新用户SESSION,COOKIE及登录时间、登录次数。
get_user_info($id=0)
P:  获取用户信息数组
assign_ur_here(cat=0,cat=0,str = '')
P: 取得当前位置和页面标题
get_parent_cats($cat)
P: 获得指定分类的所有上级分类
build_pagetitle(arr,arr,type = 'category')
P: 根据提供的数组编译成页面标题
build_urhere(arr,arr,type = 'category')
P: 根据提供的数组编译成当前位置
assign_dynamic($tmp
P: 获得指定页面的动态内容
assign_articles(id,id,num)
P: 分配文章列表给smarty
get_shop_help()
P: 分配帮助信息
assign_pager(app,app,cat, recordcount,recordcount,size, sort,sort,order, page=1,page=1,keywords = '', brand=0,brand=0,price_min = 0, pricemax=0,pricemax=0,display_type = 'list', filterattr=′′,filterattr=″,url_format='', $sch_array='')
P: 创建分页信息.分页函数.
get_pager(url,url,param, recordcount,recordcount,page = 1, $size = 10)
P: 生成给pager.lbi赋值的数组
get_vote($id = '')
P: 调用调查内容
get_user_browser()
P: 获得浏览器名称和版本
is_spider($record = true)
P: 判断是否为搜索引擎蜘蛛
get_os()
P: 获得客户端的操作系统
visit_stats()
P: 统计访问信息
save_searchengine_keyword(domain,domain,path)
P: 保存搜索引擎关键字
get_tags(goodsid=0,goodsid=0,user_id = 0)
P: 获得指定用户、商品的所有标记
get_dyna_libs(theme,theme,tmp)
P:  获取指定主题某个模板的主题的动态模块
dyna_libs_replace($matches)
P: 换动态模块
upload_file(upload,upload,type)
P: 处理上传文件,并返回上传图片名(上传失败时返回图片名为空)
show_message(content,content,links = '', hrefs=′′,hrefs=″,type = 'info', $auto_redirect = true)
P: 显示一个提示信息
parse_rate_value(str, &str, &operate)
P: 将一个形如+10, 10, -10, 10%的字串转换为相应数字,并返回操作符号
recalculate_price()
P: 重新计算购物车中的商品价格:目的是当用户登录时享受会员价格,当用户退出登录时不享受会员价格
assign_comment(id,id,type, $page = 1)
P: 查询评论内容
assign_template(ctype=′′,ctype=″,catlist = array())
P: 默认的smarty赋值
time2gmt($time)
P: 将一个本地时间戳转成GMT时间戳
get_user_bonus($user_id = 0)
P: 查询会员的红包金额
set_affiliate()
P: 保存推荐uid
get_affiliate()
P: 获取推荐uid
article_categories_tree($cat_id = 0)
P: 获得指定分类同级的所有分类以及该分类下的子分类
get_article_parent_cats($cat)
P: 获得指定文章分类的所有上级分类
get_library_number(library,library,template = null)
P: 取得某模板某库设置的数量
get_navigator(ctype=′′,ctype=″,catlist = array())
P: 取得自定义导航栏列表
license_info()
P: 授权信息内容

lib_insert.php (动态内容函数库)
insert_query_info()
P: 获得查询次数以及查询时间
insert_history()
P: 调用浏览历史
insert_cart_info()
P: 调用购物车信息
insert_ads($arr)
P: 调用指定的广告位的广告
insert_member_info()
P: 调用会员信息
insert_comments($arr)
P: 调用评论信息
insert_vote()
P: 调用在线调查信息

lib_goods.php (商品相关函数库)
goods_sort(goodsa,goodsa,goods_b)
P: 商品推荐usort用自定义排序行数
get_categories_tree($cat_id = 0)
P: 获得指定分类同级的所有分类以及该分类下的子分类
get_child_tree($tree_id = 0)
P: 取和指定分类ID下的分类树
get_top10($cats = '')
P: 调用当前分类的销售排行榜
get_recommend_goods(type=′′,type=″,cats = '')
P: 获得推荐商品
get_promote_goods($cats = '')
P: 获得促销商品
get_category_recommend_goods(type=′′,type=″,cats = '', brand=0,brand=0,min =0,  max=0,max=0,ext='')
P: 获得指定分类下的推荐商品
get_goods_info($goods_id)
P: 获得商品的详细信息
get_goods_properties($goods_id)
P: 获得商品的属性和规格
get_same_attribute_goods($attr)
P:  获得属性相同的商品
get_goods_gallery($goods_id)
P: 获得指定商品的相册
assign_cat_goods(catid,catid,num = 0, $from = 'web')
P: 获得指定分类下的商品
assign_brand_goods(brandid,brandid,num = 0, $cat_id = 0)
P: 获得指定的品牌下的商品
get_extension_goods($cats)
P: 获得所有扩展分类属于指定分类的所有商品ID
bargain_price(price,price,start, $end)
P: 判断某个商品是否正在特价促销期
spec_price($spec)
P: 获得指定的规格的价格
group_buy_info(groupbuyid,groupbuyid,current_num = 0)
P: 取得团购活动信息
group_buy_stat(groupbuyid,groupbuyid,deposit)
P: 取得某团购活动统计信息
group_buy_status($group_buy)
P: 获得团购的状态
auction_info(actid,actid,config = false)
P: 取得拍卖活动信息
auction_log($act_id)
P: 取得拍卖活动出价记录
auction_status($auction)
P: 计算拍卖活动状态(注意参数一定是原始信息)
goods_info($goods_id)
P: 取得商品信息
favourable_info($act_id)
P: 取得优惠活动信息
wholesale_info($act_id)
P: 批发信息
add_style(goodsname,goodsname,style)
P:  添加商品名样式
get_goods_attr($goods_id)
P: 取得商品属性
get_goods_fittings($goods_list = array())
P: 获得购物车中商品的配件

lib_article.php (文章及文章分类相关函数库)
get_cat_articles(catid,catid,page = 1, size=20,size=20,requirement='')
P: 获得文章分类下的文章列表
get_article_count(catid,catid,requirement='')
P: 获得指定分类下的文章总数

熟悉这些函数,可以减少不少麻烦,熟悉之后,你遍知道系统有哪些已经写好的功能,很多时候就可以直接拿来用,而不用因为不知道,去手写代码,这样就很不划算了。

lib_main.php    ECSHOP 前台公用函数库

update_user_info    更新用户SESSION,COOKIE及登录时间、登录次数。

get_user_info      获取用户信息数组

assign_ur_here    取得当前位置和页面标题

get_parent_cats    获得指定分类的所有上级分类

build_pagetitle         根据提供的数组编译成页面标题

build_urhere    根据提供的数组编译成当前位置

assign_dynamic    获得指定页面的动态内容

assign_articles         分配文章列表给smarty

get_shop_help         分配帮助信息

assign_pager   创建分页信息

get_pager    生成给pager.lbi赋值的数组

get_vote  调用调查内容

get_user_browser  获得浏览器名称和版本

is_spider  判断是否为搜索引擎蜘蛛

get_os               获得客户端的操作系统

visit_stats        统计访问信息

save_searchengine_keyword 保存搜索引擎关键字

get_tags  获得指定用户、商品的所有标记

get_dyna_libs  获取指定主题某个模板的主题的动态模块

dyna_libs_replace   替换动态模块

upload_file    处理上传文件,并返回上传图片名(上传失败时返回图片名为空)

show_message        显示一个提示信息

parse_rate_value    将一个形如+10, 10, -10, 10%的字串转换为相应数字,并返回操作符号

recalculate_price    重新计算购物车中的商品价格:目的是当用户登录时享受会员价格,当用户退出登录时不享受会员价格

assign_comment     查询评论内容

assign_template      将一些常用的参数调到前台使用

time2gmt                   将一个本地时间戳转成GMT时间戳

get_user_bonus       查询会员的红包金额

set_affiliate     保存推荐uid

get_affiliate     获取推荐uid

article_categories_tree    获得指定分类同级的所有分类以及该分类下的子分类

get_article_parent_cats    获得指定文章分类的所有上级分类

get_library_number         取得某模板某库设置的数量

get_navigator 取得自定义导航栏列表

license_info      授权信息内容

url_domain       获取域名

lib_common.php      ECSHOP 公用函数库

db_create_in    创建像这样的查询: "IN('a','b')";

is_email   验证输入的邮件地址是否合法

is_time    检查是否为一个合法的时间格式

assign_query_info   获得查询时间和次数,并赋值给smarty

region_result   创建地区的返回信息

get_regions     获得指定国家的所有省份

get_shipping_config         获得配送区域中指定的配送方式的配送费用的计算参数

&init_users      初始化会员数据整合类

cat_list     获得指定分类下的子分类的数组

cat_options      过滤和排序所有分类,返回一个带有缩进级别的数组

load_config      载入配置信息

get_brand_list          取得品牌列表

get_brands    获得某个分类下

get_promotion_info         所有的促销活动信息

get_children    获得指定分类下所有底层分类的ID

get_article_children    获得指定文章分类下所有底层分类的ID

get_mail_template 获取邮件模板

order_action    记录订单操作记录

price_format    格式化商品价格

get_virtual_goods   返回订单中的虚拟商品

virtual_goods_ship  虚拟商品发货

virtual_card_shipping      虚拟卡发货

virtual_card_result 返回虚拟卡信息

get_snatch_result   获取指定 id snatch 活动的结果

clear_tpl_files           清除指定后缀的模板缓存或编译文件

clear_compiled_files        清除模版编译文件

clear_cache_files     清除缓存文件

clear_all_files      清除模版编译和缓存文件

smarty_insert_scripts     页面上调用的js文件

smarty_create_pages     创建分页的列表

build_uri            重写 URL 地址

formated_weight        格式化重量:小于1千克用克表示,否则用千克表示

log_account_change        记录帐户变动

article_cat_list         获得指定分类下的子分类的数组

article_cat_options 过滤和排序所有文章分类,返回一个带有缩进级别的数组

uc_call               调用UCenter的函数

exception_handler  error_handle回调函数

get_image_path  重新获得商品图片与商品相册的地址

user_uc_call    调用使用UCenter插件时的函数

get_volume_price_list     取得商品优惠价格列表

get_final_price    取得商品最终使用价格

sort_goods_attr_id_array       将 goods_attr_id 的序列按照 attr_id 重新排序

is_spec              是否存在规格

get_package_info    获取指定id package 的信息

get_package_goods         获得指定礼包的商品

get_good_products          取商品的货品列表

get_good_products_select     取商品的下拉框Select列表

get_specifications_list    取商品的规格列表

lib_main.php    ECSHOP 后台管理中心公用函数

read_modules 获得所有模块的名称以及链接地址

sys_msg            系统提示信息

admin_log       记录管理员的操作内容

sys_joindate    将通过表单提交过来的年月日变量合成为"2004-05-10"的格式。

set_admin_session 设置管理员的session内容

insert_config    插入一个配置信息

admin_priv       判断管理员对某一个操作是否有权限

check_authz    检查管理员权限

check_authz_json    检查管理员权限,返回JSON格式数据

get_bonus_type       取得红包类型数组(用于生成下拉列表)

get_rank_list   取得用户等级数组,按用户级别排序

get_user_rank    按等级取得用户列表(用于生成下拉列表)

get_position_list      取得广告位置数组(用于生成下拉列表)

create_html_editor    生成编辑器

get_goods_list    取得商品列表:用于把商品添加到组合、关联类、赠品类

get_article_list    取得文章列表:用于商品关联文章

get_yes_no      返回是否(图标no.gif/yes.gif)

get_where_sql         生成过滤条件:用于 get_goodslist 和 get_goods_list

函数很多,记住那大概三分之一常用的就好了,相信会给你带来很多方便!

原文地址:https://www.cnblogs.com/houdj/p/5887818.html