首頁 > 下載 >  類別庫下載

  • <?php namespace TijsVerkoyen\CssToInlineStyles; use Symfony\Component\CssSelector\CssSelector; use Symfony\Component\CssSelector\CssSelectorConverter; use Symfony\Component\CssSelector\Exception\ExceptionInterface; use TijsVerkoyen\CssToInlineStyles\Css\Processor; use TijsVerkoyen\CssToInlineStyles\Css\Property\Processor as PropertyProcessor; use TijsVerkoyen\CssToInlineStyles\Css\Rule\Processor as RuleProcessor; use TijsVerkoyen\CssToInlineStyles\Css\Rule\Rule; class CssToInlineStyles {     private $cssConverter;     public function __construct()     {         if (class_exists('Symfony\Component\CssSelector\CssSelectorConverter')) {             $this->cssConverter = new CssSelectorConverter();         }     }這是一個郵件範本中的內聯CSS庫,需要的朋友可以下載使用

    其它類別庫29692018-01-10
  • <?php  /**   * 参数处理类   * @author JasonWei   */  class Params  {      public $get = array();        public $post = array();        function __construct()      {  if (!emptyempty($_GET)) {      foreach ($_GET as $key => $val) {  if (is_numeric($val)) {      $this->get[$key] = $this->getInt($val);  } else {      $this->get[$key] = $this->getStr($val);  }      }  }  if (!emptyempty($_POST)) {      foreach ($_POST as $key => $val) {  if (is_numeric($val)) {      $this->post[$key] = $this->getInt($val);  } else {      $this->post[$key] = $this->getStr($val);  }      }  }這是很好用的PHP防注入類,需要的朋友可以下載使用

    其它類別庫24322018-01-10
  • <?php /**  * Validator 数据验证类  */ class Validator {     /**      * 待校验数据      * @var array      */     private $_data;     /**      * 校验规则      * @var array      */     private $_ruleList = null;     /**      * 校验结果      * @var bool      */     private $_result = null;     /**      * 校验数据信息      * @var array      */     private $_resultInfo = array();     /**      * 构造函数      * @param array $data 待校验数据      */     public function __construct($data = null)     {         if ($data) {             $this->_data = $data;         }     }這是一個功能很齊全的php驗證類,需要的朋友可以下載使用

    其它類別庫30692018-01-10
  • <?php class crypt {   private $skey;   public function __construct($key) {     $this->skey = hash("md5", $key, true); //32位skey   }   public function safe_b64encode($string) {     $data = base64_encode($string);     $data = str_replace(array('+', '/', '='), array('-', '_', ''), $data);     return $data;   }   public function safe_b64decode($string) {     $data = str_replace(array('-', '_'), array('+', '/'), $string);     $mod4 = strlen($data) % 4;     if ($mod4) {       $data .= substr('====', $mod4);     }     return base64_decode($data);   }這是一個PHP的加密解密類,需要的朋友可以下載使用

    其它類別庫27862018-01-10
  • <?php class cls_http_request {   public static function curl_get($url, $timeout = 1)   {     $ch = curl_init();     curl_setopt($ch, CURLOPT_URL, $url);     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);     curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);     $result = curl_exec($ch);     curl_close($ch);     if (is_string($result) && strlen($result))     {       return $result;     }     else     {       return false;     }   }http請求處理類別(基於CURL進行封裝)get方式請求(curl)@param string $url 請求的url@param integer $ timeout 逾時時間(s)@return string(請求成功) | false(請求失敗)

    其它類別庫25752018-01-10
  • <?php class CacheLayer{   protected $root = "";   protected $cache = "";   protected $key = "";   protected $life = 0;   public function __construct($key, $root = "/cachelayer"){     $this->root = $_SERVER["DOCUMENT_ROOT"].$root;     $this->key = $key;   }   public function expired($life_span){     $this->life = $life_span;     $file = $this->root."/".$this->key.".cachelayer";     if(is_file($file)){       $mtime = filemtime($file);       return (time() >= ($mtime + $this->life));     }else{       return true;     }   }   public function put($content){     $file = $this->root."/".$this->key.".cachelayer";     if(!is_dir(dirname($this->root))){       return false;     }     $this->delete();     $content = json_encode($content);     return (bool)file_put_contents($file, $content);   }   public function get(){     $file = $this->root."/".$this->key.".cachelayer";     if(is_file($file)){       return json_decode(file_get_contents($file), true);     }     return array();   }   public function delete(){     $file = $this->root."/".$this->key.".cachelayer";     if(is_file($file)){       unlink($file);       return true;     }     return false;   } } ?>這是一個很好用的PHP快取類別庫,需要的朋友可以下載使用,可以透過檔案緩存,大大緩解資料庫的壓力

    其它類別庫21842018-01-09
  • <?php class upload { var $dir;            //附件存放物理目录 var $time;           //自定义文件上传时间 var $allow_types;    //允许上传附件类型 var $field;          //上传控件名称 var $maxsize;        //最大允许文件大小,单位为KB var $thumb_width;    //缩略图宽度 var $thumb_height;   //缩略图高度 var $watermark_file; //水印图片地址 var $watermark_pos;  //水印位置 var $watermark_trans;//水印透明度 //构造函数 //$types : 允许上传的文件类型 , $maxsize : 允许大小 ,  $field : 上传控件名称 , $time : 自定义上传时间 function upload($types = 'jpg|png', $maxsize = 1024, $field = 'attach', $time = '') { $this->allow_types = explode('|',$types); $this->maxsize = $maxsize * 1024; $this->field = $field; $this->time = $time ? $time : time(); } //设置并创建文件具体存放的目录 //$basedir  : 基目录,必须为物理路径 //$filedir  : 自定义子目录,可用参数{y}、{m}、{d} function set_dir($basedir,$filedir = '') { $dir = $basedir; !is_dir($dir) && @mkdir($dir,0777); if (!empty($filedir)) { $filedir = str_replace(array('{y}','{m}','{d}'),array(date('Y',$this->time),date('m',$this->time),date('d',$this->time)),strtolower($filedir));//用string_replace把{y} {m} {d}几个标签进行替换 $dirs = explode('/',$filedir); foreach ($dirs as $d) { !empty($d) && $dir .= $d.'/'; !is_dir($dir) && @mkdir($dir,0777); } } $th支援浮水印,日期,縮圖的php多文件上傳類,設置並創建文件具體存放的目錄,圖片縮圖設置,如果不生成縮圖則不用設置,圖片水印設置,如果不生成添加水印則不用設置,執行檔上傳,處理完返回一個包含上傳成功或失敗的檔案資訊陣列。

    其它類別庫27032018-01-09
  • <?php class IP {      public static function generate($province = '')     {         $ip_address = self::_IPSegment($province);         $ip = self::_randomIP($ip_address['begin'], $ip_address['end']);         return $ip;     }     public static function update()     {         require 'QueryList.class.php';         $province = array(             'BJ', 'GD', 'SD', 'ZJ', 'JS', 'SH', 'LN', 'SC', 'HA',             'HB', 'FJ', 'HN', 'HE', 'CQ', 'SX', 'JX', 'SN', 'AH',             'HL', 'GX', 'JL', 'YN', 'TJ', 'NM', 'XJ', 'GS', 'GZ',             'HI', 'NX', 'QH', 'XZ'         );         $count = count($province);         $ip_segment = array();         for ($i = 0; $i < $count; $i++) {             // 采集IP地址段目标网址             $url = 'http://ips.chacuo.net/view/s_' . $province[$i];             $ip_list = QueryList::Query($url, array('begin' => array('.v_l', 'text'), 'end' => array('.v_r', 'text')), '', 'UTF-8');             $ip_array = $ip_list->jsonArr;             $ip_segment[$province[$i]] = $ip_array;         }         $path = str_replace('\', '/', __DIR__);         $file = $path . '/ip_segment.php';         $res = self::_write($file, $ip_segment);         if ($res) {             echo 'Update OK!';         }     }依省份名稱(中文)隨機產生IPV4位址$province為空則隨機國內省份#

    其它類別庫33852018-01-09
  • (function(w){     // the heatmapFactory creates heatmap instances     var heatmapFactory = (function(){     // store object constructor     // a heatmap contains a store     // the store has to know about the heatmap in order to trigger heatmap updates when datapoints get added     var store = function store(hmap){         var _ = {             // data is a two dimensional array             // a datapoint gets saved as data[point-x-value][point-y-value]             // the value at [point-x-value][point-y-value] is the occurrence of the datapoint             data: [],             // tight coupling of the heatmap object             heatmap: hmap         };         // the max occurrence - the heatmaps radial gradient alpha transition is based on it         this.max = 1;         this.get = function(key){             return _[key];         };         this.set = function(key, value){             _[key] = value;         };     }設定熱力圖展現的詳細資料, 實作之後,即可以立刻展現 #@param {Json Object } data{"<b>max</b>" : {Number} 權重的最大值,<br />"<b>data</b>" : {Array} 座標詳細資料,格式如下<br/>{"lng":116.421969,"lat":39.913527,"count":3}, 其中<br/>#lng lat分別為經緯度, count權重值####################################################################################################################################################################################### ##新增勢力圖的詳細座標點######@param {Number} lng 經度座標######@param {Number} lat 經度座標#####@param {Number} count 經度座標############

    其它類別庫32372018-01-09
  • <?php /**  * 阿里云短信验证码发送类  */ class Sms {   // 保存错误信息   public $error;   // Access Key ID   private $accessKeyId = '';   // Access Access Key Secret   private $accessKeySecret = '';   // 签名   private $signName = '';   // 模版ID   private $templateCode = '';   public function __construct($cofig = array()) {     $cofig = array (       'accessKeyId' => '***************',       'accessKeySecret' => '******************',       'signName' => '七零',       'templateCode' => 'SMS_25300059'     );     // 配置参数     $this->accessKeyId = $cofig ['accessKeyId'];     $this->accessKeySecret = $cofig ['accessKeySecret'];     $this->signName = $cofig ['signName'];     $this->templateCode = $cofig ['templateCode'];   }InvalidDayuStatus.Malformed' => '帳戶簡訊開啟狀態不正確',InvalidSignName.Malformed' => '簡訊簽名不正確或簽章狀態不正確',InvalidTemplateCode.MalFormed' => '簡訊模板Code不正確或模板狀態不正確',InvalidRecNum.Malformed' => '目標手機號碼不正確,單次發送數量不能超過100', InvalidParamString.MalFormed' => '簡訊範本中變數不是json格式',InvalidParamStringTemplate.Malformed' => '簡訊範本中變數與範本內容不符' InvalidSendSms' => '觸發業務流控InvalidDayu.Malformed' => '變數不能是url,可以將變數固化在模板中

    其它類別庫27902018-01-09
  • <?php class HttpDownload {   private $m_url = "";   private $m_urlpath = "";   private $m_scheme = "http";   private $m_host = "";   private $m_port = "80";   private $m_user = "";   private $m_pass = "";   private $m_path = "/";   private $m_query = "";   private $m_fp = "";   private $m_error = "";   private $m_httphead = "" ;   private $m_html = "";   public function PrivateInit($url){     $urls = "";     $urls = @parse_url($url);     $this->m_url = $url;     if(is_array($urls)) {       $this->m_host = $urls["host"];       if(!empty($urls["scheme"])) $this->m_scheme = $urls["scheme"];       if(!empty($urls["user"])) $this->m_user = $urls["user"];       if(!empty($urls["pass"])) $this->m_pass = $urls["pass"];       if(!empty($urls["port"])) $this->m_port = $urls["port"];       if(!empty($urls["path"])) $this->m_path = $urls["path"];       $this->m_urlpath = $this->m_path;       if(!empty($urls["query"])) {         $this->m_query = $urls["query"];         $this->m_urlpath .= "?".$this->m_query;       }     }   }初始化-開啟指定網址--重設各參數-初始化系統-獲得某操作錯誤的原因-判別用Get方法發送的頭的應答結果是否正確-看看返回的網頁是否是text類型-判斷傳回的網頁是否是特定的類型- HTTP 協定下載檔案

    其它類別庫28192018-01-08
  • <?php function qsort(&$arr) {   _quick_sort($arr, 0, count($arr) - 1); } function _quick_sort(&$arr, $low, $high) {   $low_data = $arr[$low];   $prev_low = $low;   $prev_high = $high;   while ($low < $high)   {     while ($arr[$high] >= $low_data && $low < $high) {       $high--;     }     if ($low < $high) {       $arr[$low] = $arr[$high];       $low++;     }     while ($arr[$low] <= $low_data && $low < $high) {       $low++;     }     if ($low < $high) {       $arr[$high] = $arr[$low];       $high--;     }   }採用遞歸演算法的快速排序。 @param array $arr 要排序的陣列@param int $low  最低的排序子段@param int $high 最高的排序欄位

    其它類別庫19492018-01-08