phpcms常用函數


1、./libs/functions/global.func.php
    
--------------------------------------------------
字符串安全處理函數
-------------------------------------------------------
    new_addslashes($string) 返回經 addslashes處理過得字符或數組
    
    new_stripslashes($string)返回經stripslashes處理過得字符或數組

    new_htmlspecialchars($string)返回經htmlspecialchars處理過得字符或數組

    safe_replace($string)  安全過濾函數

    trim_textarea($string)  格式化文本域: 新行前添加換行標記,空格轉為&nbsp

    trim_script  轉義 javascript 代碼標記
    
   str_cut($string/字符串, $length/截取長度, $dot = '...'/結尾填充)  支持UTF8/GBK
-----------------------------------------
   get_url() 獲取當前頁面完整URL地址

   ip()   獲取請求IP
------------------------------------------
字符串操作類函數
----------------------------------------------
    random($length, $chars = '0123456789') 產生隨機字符串
    
    生成隨機字符串create_randomstr($lenth = 6) 范圍:'123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ'

    string2array($data)    字符串轉為數組
    
    array2string($data, $isformdata = 1)  數組轉為字符串

--------------------
字符串加密解密
--------------------
   sys_auth($string, $operation = 'ENCODE'/ENCODE加密,DECODE為解密,默認為ENCODE, $key = ''密鑰, $expiry = 0/過期時間)

--------------------------------------------------
語言方法
    L ($language = '數組中的鍵名',$pars = array(), $modules = '對應模塊語言')  //$modules=''時默認為system.lang.php  返回鍵值
---------------------------------------------
調用前台模板
===============
     template($module = 'content'/對應模塊, $template = 'index'/頁面, $style = '')

調用后台模板
    
    admin::admin_tpl($file/文件名, $m = ''/默認為文件所在模塊)
------------------------------------------------------------------
提示信息頁面跳轉 showmessage($msg/信息, $url_forward = 'goback'/跳轉位置, $ms = 1250, $dialog = '', $returnjs = '')   //有待更改默認后台跳到admin,前台:content
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    fileext($filename) 取得文件擴展名

|||||||||||||||||||||||||||||||||||||||||||||||||||||

緩存操作
--------------
   寫入緩存    setcache($name/名稱, $data/數據, $filepath=''/路徑(默認caches/caches_$filepath/caches_data/), $type='file'(默認)/緩存類型[file,memcache,apc], $config='', $timeout=0/過期時間)

   加載模板標簽緩存  tpl_cache($name,$times = 0)                                         目的文件:caches/caches_$filepath/caches_data/$name.cache.php

  讀取緩存  getcache($name, $filepath='', $type='file', $config='')

  刪除緩存  delcache($name, $filepath='', $type='file', $config='')    
 
  讀取緩存文件信息 getcacheinfo($name, $filepath='', $type='file', $config='')
|||||||||||||||||||||||||||||||||||||||||||||||||||||

分頁函數  pages($num,      $curr_page, $perpage = 20, $urlrule = '', $array = array(),$setpages = 10)   返回分頁

        信息總數, 當前分頁,  每頁顯示數,   URL規則...

URL路徑解析,pages 函數的輔助函數  url_par($par, $url = '')  $par 默認為page={$page}  返回URL

    驗證郵箱    is_email($email)  

    檢查用戶名是否符合規定  is_username($username)

///////////////////////////////////////////////

網站一些參數獲取
==================

獲取當前的站點I get_siteid()

獲取用戶昵稱       get_nickname($userid='', $field='')  不傳入userid取當前用戶nickname,如果nickname為空取username||傳入field,取用戶$field字段信息

通過ID獲取用戶信息       get_memberinfo($userid, $field='')  不傳入$field返回用戶所有信息,傳入field,取用戶$field字段信息

通過 username 值,獲取用戶所有信息   get_memberinfo_buyusername($username, $field='')

獲取用戶頭像,建議傳入phpssouid  get_memberavatar($uid/默認為phpssouid, $is_userid='', $size='30')

///////////////////////////////////////////////
    
    判斷IE瀏覽器  is_ie()

    文件下載    file_down($filepath/文件路徑, $filename = ''/文件名稱)

    對用戶的密碼進行加密  password($password, $encrypt='')

    對(字符串或數組)數據進行編碼轉換    array_iconv($data, $input = 'gbk', $output = 'utf-8')

    生成縮略圖函數   thumb($imgurl, $width = 100, $height = 100 ,$autocut = 1, $smallpic = 'nopic.gif')

    水印添加    watermark($source, $target = '',$siteid)
===========================================================================

生成SEO  seo($siteid, $catid = '', $title = '', $description = '', $keyword = '')   返回數組

         站點ID    ,欄目ID,  標題      ,  描述             ,關鍵詞

獲取站點的信息   siteinfo($siteid)

生成CNZZ統計代碼tjcode()

獲取站點域名siteurl($siteid)

文本轉換為圖片   string2img($txt, $fonttype = 5, $fontsize = 16, $font = '', $fontcolor = 'FF0000',$transparent = '1')

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-----------------------------------------------   -----------------------------------
2、./libs/functions/iconv.func.php   字符編碼轉換函數

3、./libs/functions/mail.func.php   發郵件函數

4、./libs/functions/extention.func.php  擴展函數


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM