pbootcms函數(shù)庫文件
|-core/function | |-file.php //數(shù)據(jù)處理 | |-handle.php //公共函數(shù) | |-helper.php //助手函數(shù)
1.1、數(shù)據(jù)處理
函數(shù)名 | 實(shí)現(xiàn)功能 | 備注 |
---|---|---|
check_dir($path, $create = false) | 檢測目錄是否存在 | |
create_dir($path) | 創(chuàng)建目錄 | |
check_file($path, $create = false, $content = null) | 檢查文件是否存在 | |
create_file($path, $content = null, $over = false) | 創(chuàng)建文件 | |
dir_list($path) | 目錄文件夾列表 | |
file_list($path) | 目錄文件列表 | |
path_list($path) | 目錄下文件及文件夾列表 | |
path_delete($path, $delDir = false) | 刪除目錄及目錄下所有文件或刪除指定文件 | |
dir_copy($src, $des, $son = 1) | 拷貝文件夾 | |
is_image($path) | 判斷文件是否是圖片 | webp可自行加入 |
upload($input_name, $file_ext = null, $max_width = null, $max_height = null, $watermark = false) | 文件上傳 | |
handle_upload($file, $temp, $array_ext_allow, $max_width, $max_height, $watermark) | 處理并移動(dòng)上傳文件 | |
resize_img($src_image, $out_image = null, $max_width = null, $max_height = null, $img_quality = 90) | 等比縮放圖片 | |
cut_img($src_image, $out_image = null, $new_width = null, $new_height = null, $img_quality = 90) | 剪切圖片 | |
watermark_img($src_image, $out_image = null, $position = null, $watermark_image = null, $watermark_text = '', $watermark_text_size = null, $watermark_text_color = null) | 圖片水印 |
1.2、公共函數(shù)
函數(shù)名 | 實(shí)現(xiàn)功能 | 備注 |
---|---|---|
get_user_bs($bs = null) | 獲取用戶瀏覽器類型 | |
get_user_os($osstr = null) | 獲取用戶操作系統(tǒng)類型 | |
get_user_ip() | 獲取用戶IP | |
get_url($url, $fields = array(), $UserAgent = null, $vfSSL = false) | 執(zhí)行URL請求,并返回?cái)?shù)據(jù) | |
get_date($timestamp = null) | 返回時(shí)間戳格式化日期時(shí)間,默認(rèn)當(dāng)前 | |
get_date_diff($startstamp, $endstamp, $return = 'm') | 返回時(shí)間戳差值部分,年、月、日 | |
get_tree($data, $tid, $idField, $pidField, $sonName = 'son') | 生成無限極樹,$data為二維數(shù)組數(shù)據(jù) | |
get_mapping($array, $vValue, $vKey = null) | 獲取數(shù)據(jù)數(shù)組的映射數(shù)組 | |
get_page() | 頁碼賦值,異常返回1 | |
get_request_method() | 返回請求類型 | |
get_current_url() | 獲取當(dāng)前完整URL地址 | |
get_strpos($string, $find, $n) | 獲取字符串第N次出現(xiàn)位置 | |
escape_string($string) | 獲取轉(zhuǎn)義數(shù)據(jù),支持字符串、數(shù)組、對象 | |
decode_string($string) | 字符反轉(zhuǎn)義html實(shí)體及斜杠,支持字符串、數(shù)組、對象 | |
decode_slashes($string) | 字符反轉(zhuǎn)義斜杠,支持字符串、數(shù)組、對象 | |
encrypt_string($string) | 字符串雙層MD5加密 | |
get_uniqid() | 生成唯一標(biāo)識(shí)符 | |
clear_html_blank($string) | 清洗html代碼的空白符號(hào) | |
rim_slash($string) | 去除字符串兩端斜線 | |
hump_to_underline($string) | 駝峰轉(zhuǎn)換下劃線加小寫字母 | |
object_to_array($object) | 轉(zhuǎn)換對象為數(shù)組 | |
array_to_object($array) | 轉(zhuǎn)換數(shù)組為對象 | |
in_object($needle, $object) | 值是否在對象中 | |
result_value_search($needle, $result, $skey) | 結(jié)果集中查找指定字段父節(jié)點(diǎn)是否存在 | |
mult_array_merge($array1, $array2) | 多維數(shù)組合并 | |
implode_quot($glue, array $pieces, $diffnum = false) | 數(shù)組轉(zhuǎn)換為帶引號(hào)字符串 | |
is_multi_array($array) | 是否為多維數(shù)組,是返回true | |
is_mobile() | 是否為移動(dòng)設(shè)備 | |
is_post() | 是否為POST請求 | |
is_get() | 是否為GET請求 | |
is_put() | 是否為PUT請求 | |
is_patch() | 是否為PATCH請求 | |
is_delete() | 是否為DELETE請求 | |
is_delete() | 是否為AJAX請求 | |
is_https() | 判斷當(dāng)前是否為https | |
get_http_url($noport = false) | 獲取當(dāng)前訪問地址 | |
get_http_host($noport = true) | 獲取當(dāng)前訪問域名 | |
substr_both($string, $strat, $length) | 中英混合的字符串截取,以一個(gè)漢字為一個(gè)單位長度,英文為半個(gè) | |
strlen_both($string) | 中英混合的字符串長度,以一個(gè)漢字為一個(gè)單位長度,英文為半個(gè) | |
query_string($unset = null) | 獲取地址參數(shù) | |
preg_replace_r($search, $replace, $subject) | 遞歸替換 | |
create_code($len = 4) | 生成隨機(jī)驗(yàn)證碼 |
1.3、助手函數(shù)
函數(shù)名 | 實(shí)現(xiàn)功能 | 備注 |
---|---|---|
url($url, $suffix = false) | 生成實(shí)際跳轉(zhuǎn)路徑 | 接收控制器方法訪問完整路徑,如:/home/index/index |
homeurl($url, $suffix = null, $qs = null) | 生成前端路徑 | |
error($string, $jump_url = null, $time = 2) | 自定義錯(cuò)誤頁面 | |
success($string, $jump_url = null, $time = 2) | 自定義成功頁面 | |
alert($info, $status = 0) | alert彈窗 | |
alert_back($info, $status = 0) | 彈窗并返回前頁 | |
location($url) | 跳轉(zhuǎn) | |
alert_location($info, $url, $status = 0) | 彈窗并跳轉(zhuǎn) | |
alert_close($info, $status = 0) | 彈窗并關(guān)閉 | |
model($name = null, $new = false) | 實(shí)例化模型對象助手 | |
api($args = null) | api讀取數(shù)據(jù) | |
display($tpl) | 輸出模板內(nèi)容 | |
parser($tpl) | 解析模板內(nèi)容 | |
set_theme($theme_name) | 設(shè)置模板 | |
assign($var, $value) | 注入模板變量 | |
get_var($var) | 變量獲取接口 | |
page($tatal, $morePageStr = false) | 手動(dòng)生成分頁信息,返回限制語句 | |
response($data) | 內(nèi)容輸出助手函數(shù) | |
json($code, $data, $tourl = null) | Json內(nèi)容輸出助手函數(shù) | |
filter($varname, $condition) | 數(shù)據(jù)過濾 | 詳細(xì)使用建議閱讀源碼 |
get($name, $type = null, $require = false, $vartext = null, $default = null) | 獲取GET參數(shù) | |
post($name, $type = null, $require = false, $vartext = null, $default = null) | 獲取POST參數(shù) | |
request($name, $type = null, $require = false, $vartext = null, $default = null) | 獲取參數(shù),post或get | |
cookie($name, $value = null, $expire = null, $path = null, $domain = null, $secure = null, $httponly = true) | 讀取或?qū)懭隒ookie信息 | |
session($name, $value = null) | 讀取或?qū)懭雜ession信息 | |
issetSession($name) | 檢查會(huì)話參數(shù)是否存在 | |
sendmail(array $config, $to, $subject, $body) | 快速發(fā)送郵件函數(shù) | |
_404($string, $jump_url = null, $time = 2) | 返回404頁面,文件中可使用{info}替換提示信息 |
如果您的問題還未解決可以聯(lián)系站長付費(fèi)協(xié)助。

有問題可以加入技術(shù)QQ群一起交流學(xué)習(xí)
本站vip會(huì)員 請加入無憂模板網(wǎng) VIP群(50604020) PS:加入時(shí)備注用戶名或昵稱
普通注冊會(huì)員或訪客 請加入無憂模板網(wǎng) 技術(shù)交流群(50604130)
客服微信號(hào):15898888535
聲明:本站所有文章資源內(nèi)容,如無特殊說明或標(biāo)注,均為采集網(wǎng)絡(luò)資源。如若內(nèi)容侵犯了原著者的合法權(quán)益,可聯(lián)系站長刪除。