天天看點

ecshop 函數清單大全

最近進行ecshop的二次開發,整理了一部分的函數,另外在ecshop論壇上面也發現了很多函數說明,整理彙總如下,供大家參考。
所有函數功能說明:
lib_time.php
 gmtime()
 P: 獲得目前格林威治時間的時間戳 /$0
 server_timezone()
 P: 獲得伺服器的時區 /$0
 local_mktime($hour = NULL , $minute= NULL, $second = NULL, $month = NULL, $day = NULL, $year = NULL)
 P: 生成一個使用者自定義時區日期的GMT時間戳
 local_date($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, $length = 0, $append = true)
 P: 截取UTF-8編碼下字元串的函數
 real_ip()
 P: 獲得使用者的真實IP位址
 str_len($str)
 P: 計算字元串的長度(漢字按照兩個字元計算)
 get_crlf()
 P: 獲得使用者作業系統的換行符
 send_mail($name, $email, $subject, $content, $type = 0, $notification=false)
 P: 郵件發送
 gd_version()
 P: 獲得伺服器上的 GD 版本
 file_get_contents($file)
 P: 如果系統不存在file_get_contents函數則聲明該函數
 file_put_contents($file, $data, $flags = ”)
 P: 如果系統不存在file_put_contents函數則聲明該函數
 floatval($n)
 P: 如果系統不存在 floatval 函數則聲明該函數
 file_mode_info($file_path)
 P: 檔案或目錄權限檢查函數
 log_write($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, $realname = ”, $limit_ext_types = ”)
 P: 檢查檔案類型 /檔案名/真實檔案名/允許的檔案類型
 mysql_like_quote($str)
 P: 對 MYSQL LIKE 的内容進行轉義 過濾掉_ %等字元.
 real_server_ip()
 P: 擷取伺服器的ip
 ecs_header($string, $replace = true, $http_response_code = 0)
 P: 自定義 header 函數,用于過濾可能出現的安全隐患
 ecs_iconv($source_lang, $target_lang, $source_string = ”)
 P: 自定義的編碼轉換
 ecs_geoip($ip)
 P: 取得IP的位址,采用IP庫
 trim_right($str)
 P: 去除字元串右側可能出現的亂碼
 move_upload_file($file_name, $target_name = ”)
 P: 将上傳檔案轉移到指定位置
 json_str_iconv($str)
 P: 将JSON傳遞的參數轉碼
 get_file_suffix($file_name, $allow_type = array())
 P: 擷取檔案字尾名,并判斷是否合法
 read_static_cache($cache_name)
 P: 讀結果緩存檔案
 write_static_cache($cache_name, $caches)
 P: 寫結果緩存檔案
lib_common.php (公用函數庫)
 db_create_in($item_list, $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, $sel_name, $type)
 P: 建立地區的傳回資訊
 get_regions($type = 0, $parent = 0)
 P: 獲得指定國家的所有省份, 函數需要資料庫支援.
 get_shipping_config($area_id)
 P: 獲得配送區域中指定的配送方式的配送費用的計算參數 比如快捷公司不同.
 init_users()
 P: 初始化會員資料整合類
 cat_list($cat_id = 0, $selected = 0, $re_type = true, $level = 0, $is_show_all = true)
 P: 獲得指定分類下的子分類的數組, $re_type控制傳回類型
 cat_options($spec_cat_id, $arr)
 P: 過濾和排序所有分類,傳回一個帶有縮進級别的數組
 load_config()
 P: 載入配置資訊
 get_brand_list()
 P: 取得品牌清單
 get_brands($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($order_sn, $order_status, $shipping_status, $pay_status, $note = ”, $username = null)
 P: 記錄訂單操作記錄
 price_format($price, $change_price = true)
 P: 格式化商品價格
 get_virtual_goods($order_id, $shipping = false)
 P: 傳回訂單中的虛拟商品 記錄是否發貨.
 virtual_goods_ship(&$virtual_goods, &$msg, $order_sn, $return_result = false, $process = ‘other’)
 P: 虛拟商品發貨
 virtual_card_shipping ($goods, $order_sn, &$msg, $process = ‘other’)
 P: 虛拟卡發貨
 virtual_card_result($order_sn, $goods)
 P: 傳回虛拟卡資訊
 get_snatch_result($id)
 P: 擷取指定 id snatch 活動的結果
 clear_tpl_files($is_cache = 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, $params, $append = ”, $page = 0, $size = 0)
 P: 重寫 URL 位址
 formated_weight($weight)
 P: 格式化重量
 log_account_change($user_id, $user_money = 0, $frozen_money = 0, $rank_points = 0, $pay_points = 0, $change_desc = ”, $change_type = ACT_OTHER)
 P: 記錄帳戶變動
 article_cat_list($cat_id = 0, $selected = 0, $re_type = true, $level = 0)
 P: 獲得指定分類下的子分類的數組/ 向下取數組.
 article_cat_options($spec_cat_id, $arr)
 P: 過濾和排序所有文章分類,傳回一個帶有縮進級别的數組
 uc_call($func, $params=null)
 P: 調用UCenter的函數
 exception_handler($errno, $errstr, $errfile, $errline)
 P: error_handle回調函數未啟用.
 get_image_path($goods_id, $image=”, $thumb=false, $call=’goods’, $del=false)
 P: 重新獲得商品圖檔與商品相冊的位址
 user_uc_call($func, $params = null)
 P: 調用使用UCenter插件時的函數
 get_volume_price_list($goods_id, $price_type = ‘1′)
 P: 取得商品優惠價格清單
 get_final_price($goods_id, $goods_num = ‘1′, $is_spec_price = 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, $str = ”)
 P: 取得目前位置和頁面标題
 get_parent_cats($cat)
 P: 獲得指定分類的所有上級分類
 build_pagetitle($arr, $type = ‘category’)
 P: 根據提供的數組編譯成頁面标題
 build_urhere($arr, $type = ‘category’)
 P: 根據提供的數組編譯成目前位置
 assign_dynamic($tmp
 P: 獲得指定頁面的動态内容
 assign_articles($id, $num)
 P: 配置設定文章清單給smarty
 get_shop_help()
 P: 配置設定幫助資訊
 assign_pager($app, $cat, $record_count, $size, $sort, $order, $page = 1,$keywords = ”, $brand = 0, $price_min = 0, $price_max = 0, $display_type = ‘list’, $filter_attr=”, $url_format=”, $sch_array=”)
 P: 建立分頁資訊.分頁函數.
 get_pager($url, $param, $record_count, $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, $path)
 P: 儲存搜尋引擎關鍵字
 get_tags($goods_id = 0, $user_id = 0)
 P: 獲得指定使用者、商品的所有标記
 get_dyna_libs($theme, $tmp)
 P: 擷取指定主題某個模闆的主題的動态子產品
 dyna_libs_replace($matches)
 P: 換動态子產品
 upload_file($upload, $type)
 P: 處理上傳檔案,并傳回上傳圖檔名(上傳失敗時傳回圖檔名為空)
 show_message($content, $links = ”, $hrefs = ”, $type = ‘info’, $auto_redirect = true)
 P: 顯示一個提示資訊
 parse_rate_value($str, &$operate)
 P: 将一個形如+10, 10, -10, 10%的字串轉換為相應數字,并傳回操作符号
 recalculate_price()
 P: 重新計算購物車中的商品價格:目的是當使用者登入時享受會員價格,當使用者登出時不享受會員價格
 assign_comment($id, $type, $page = 1)
 P: 查詢評論内容
 assign_template($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, $template = null)
 P: 取得某模闆某庫設定的數量
 get_navigator($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($goods_a, $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 = ”, $cats = ”)
 P: 獲得推薦商品
 get_promote_goods($cats = ”)
 P: 獲得促銷商品
 get_category_recommend_goods($type = ”, $cats = ”, $brand = 0, $min =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($cat_id, $num = 0, $from = ‘web’)
 P: 獲得指定分類下的商品
 assign_brand_goods($brand_id, $num = 0, $cat_id = 0)
 P: 獲得指定的品牌下的商品
 get_extension_goods($cats)
 P: 獲得所有擴充分類屬于指定分類的所有商品ID
 bargain_price($price, $start, $end)
 P: 判斷某個商品是否正在特價促銷期
 spec_price($spec)
 P: 獲得指定的規格的價格
 group_buy_info($group_buy_id, $current_num = 0)
 P: 取得團購活動資訊
 group_buy_stat($group_buy_id, $deposit)
 P: 取得某團購活動統計資訊
 group_buy_status($group_buy)
 P: 獲得團購的狀态
 auction_info($act_id, $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($goods_name, $style)
 P: 添加商品名樣式
 get_goods_attr($goods_id)
 P: 取得商品屬性
 get_goods_fittings($goods_list = array())
 P: 獲得購物車中商品的配件
lib_article.php (文章及文章分類相關函數庫)
 get_cat_articles($cat_id, $page = 1, $size = 20 ,$requirement=”)
 P: 獲得文章分類下的文章清單
 get_article_count($cat_id ,$requirement=”)
 P: 獲得指定分類下的文章總數