首页 > 下载 >  类库下载

  • <?php class get_c_str {   var $str;   var $start_str;   var $end_str;   var $start_pos;   var $end_pos;   var $c_str_l;   var $contents;   function get_str($str, $start_str, $end_str)   {     $this->str = $str;     $this->start_str = $start_str;     $this->end_str = $end_str;     $this->start_pos = strpos($this->str, $this->start_str) + strlen($this->start_str);     $this->end_pos = strpos($this->str, $this->end_str);     $this->c_str_l = $this->end_pos - $this->start_pos;     $this->contents = substr($this->str, $this->start_pos, $this->c_str_l);     return $this->contents;   } }这是一个php截取字符串的类,需要的朋友可以下载使用。

    其它类库19872017-12-31
  • <?php class   mobile{      function   getPhoneNumber(){         if   (isset($_SERVER[ 'HTTP_X_NETWORK_INFO '])){             $str1   =   $_SERVER[ 'HTTP_X_NETWORK_INFO '];             $getstr1   =   preg_replace( '/(.*,)(11[d])(,.*)/i ', '2 ',$str1);             Return   $getstr1;         }elseif   (isset($_SERVER[ 'HTTP_X_UP_CALLING_LINE_ID '])){             $getstr2   =   $_SERVER[ 'HTTP_X_UP_CALLING_LINE_ID '];             Return   $getstr2;         }elseif   (isset($_SERVER[ 'HTTP_X_UP_SUBNO '])){             $str3   =   $_SERVER[ 'HTTP_X_UP_SUBNO '];             $getstr3   =   preg_replace( '/(.*)(11[d])(.*)/i ', '2 ',$str3);             Return   $getstr3;         }elseif   (isset($_SERVER[ 'DEVICEID '])){             Return   $_SERVER[ 'DEVICEID '];         }else{             Return   false;         }     }这是一个php获得的手机号码与ip地址类,需要的朋友可以下载使用

    其它类库30062017-12-31
  • <?php //封装php中的单文件(图片)上传类 header('content-type:text/html;charset=utf-8'); class Upload{ //定义一个属性,专门保存错误信息 public static $error; //文件转移的方法 public function uploadFile($file,$size,$path){ if(!is_dir($path)){ $this->mkPath($path); } $allow=array('image/jpeg','image/jpg','image/png','image/gif'); //首先判断文件是否已上传到临时目录 if(!is_array($file)){ Upload::$error='不是一个有效的文件'; return false; } //判断文件是否上传到临时目录成功 switch($file['error']){ case 1:这是一个php封装的图片上传类,需要的朋友可以下载使用

    其它类库29372017-12-31
  • <?  class CMailFile {        var $subject;     var $addr_to;     var $text_body;     var $text_encoded;     var $mime_headers;     var $mime_boundary = "--==================_846811060==_";     var $smtp_headers;          function CMailFile($subject,$to,$from,$msg,$filename,$downfilename,$mimetype = "application/octet-stream",$mime_filename = false) {       $this->subject = $subject;          $this->addr_to = $to;          $this->smtp_headers = $this->write_smtpheaders($from);      $this->text_body = $this->write_body($msg);      $this->text_encoded = $this->attach_file($filename,$downfilename,$mimetype,$mime_filename);      $this->mime_headers = $this->write_mimeheaders($filename, $mime_filename);    }        function attach_file($filename,$downfilename,$mimetype,$mime_filename) {      $encoded = $this->encode_file($filename);      if ($mime_filename) $filename = $mime_filename;      $out = "--" . $this->mime_boundary . "\n";      $out = $out . "Content-type: " . $mimetype . "; name=\"$filename\";\n";      $out = $out . "Content-Transfer-Encoding: base64\n";      $out = $out . "Content-disposition: attachment; filename=这是一个php的附件邮件类,需要的朋友可以下载使用

    其它类库21722017-12-31
  • <?php class mysafe{ public $logname; public $isshwomsg; function __construct(){ set_error_handler('MyError',E_ALL); //----- } function MyError($errno, $errstr, $errfile, $errline){ echo "<b>Error number:</b> [$errno],error on line $errline in $errfile<br />"; exit; } function wlog($logs){ if(empty($logname)){ $this->logname=$_SERVER["DOCUMENT_ROOT"]."/log.htm"; } $Ts=fopen($this->logname,"a+"); fputs($Ts,$logs."\r\n"); fclose($Ts); } function showmsg($msg='',$flag=false){ $this->isshwomsg=empty($this->isshwomsg) ? false : true; if ($this->isshwomsg) { echo '<br />--------------------------------------<br />'; echo $msg; echo '<br />--------------------------------------<br />'; if ($flag) exit;这是一个php参数数据过滤安全类,需要的朋友可以下载使用

    其它类库22132017-12-31
  • <?php header('Content-Type:text/html;charset=utf-8'); /**  * 一个用于抓去图片的类  */ class download_image {     public $_save_path = NULL; //图片保存路劲     public $_limit_size = NULL; //图片限制大小     public static $_img_url_old = array();  //存储已抓取过的图片链接地址     public static $_a_page_url = array();    //存储抓取过的页面     public function __construct( $_save_path, $_limit_size) {         $this->_save_path = $_save_path;         $this->_limit_size = $_limit_size;     }     public function get_all_page_image( $site_url ) {         if ( $site_url == '' ) {             return false;         }         if ( ! in_array( $site_url, self::$_a_page_url ) ) {  //判断当前页面是否抓取过             self::$_a_page_url[] = $site_url;   //将超链接存入静态数组中         } else {             return;     //若抓取过则跳出         }1.找到一个页面2.正则过滤所有的img3.正则过滤出所有的src的属性4.获取链接信息,写入文件 file_get_contents(), file_put_contents()5.在cli模式下运行代码(浏览器运行可能内存爆掉,或运行超时)

    其它类库21952017-12-30
  • <? /* 用户需要事先定义的常量: _CachePath_        模板缓存路径 _CacheEnable_        自动缓存机制是否开启,未定义或为空,表示关闭自动缓存机制 _ReCacheTime_        自动重新缓存间隔时间,单位为秒,未定义或为空,表示关闭自动重新缓存 */ class cache {     var $cachefile;     var $cachefilevar;     function cache()     {         //生成当前页的Cache组文件名 $this->cachefilevar 及文件名 $this->cachefile         //动态页的参数不同对应的Cache文件也不同,但是每一个动态页的所有Cache文件都有相同的文件名,只是扩展名不同         $s=array(".","/");$r=array("_","");         $this->cachefilevar=str_replace($s,$r,$_SERVER["SCRIPT_NAME"])."_".$_GET[_ActionVar_];         $this->cachefile=$this->cachefilevar.".".md5($_SERVER["REQUEST_URI"]);     }缓存就是数据交换的缓冲区,当某一硬件要读取数据时,会首先从缓存中查找需要的数据,如果找到了则直接执行,找不到的话则从内存中找。由于缓存的运行速度比内存快得多,故缓存的作用就是帮助硬件更快地运行。因为缓存往往使用的是RAM,所以在用完后还是会把文件送到硬盘等存储器里永久存储。电脑里最大的缓存就是内存条了,最快的是CPU上镶的L1和L2缓存,显卡的显存是给显卡运算芯片用的缓存,硬盘上也有16M或者32M的缓存。

    其它类库19352017-12-30
  • <?php class Request{ public static function post($url, $post_data = '', $timeout = 5){//curl $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_POST, 1); if($post_data != ''){ curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); } curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_HEADER, false); $file_contents = curl_exec($ch); curl_close($ch);Post()函数用于向窗口发送非PowerBuilder预定义事件的消息,这个窗口可以是PowerBuilder应用的窗口,也可以是其它应用的窗口。Post()函数把发送的消息放置在指定窗口消息队列的尾部,然后返回到应用程序中,它并不等待相应事件事件处理程序的执行。这一点与Send()函数不同,Send()函数直接触发指定窗口相应的事件,执行事件处理程序后返回到调用应用中。因此,我们说Post()函数采用的是异步方式,Send()函数采用的是同步方式。Post()函数的参数handle指定接收消息的窗口句柄,对PowerBuilder窗口来说,使用Handle()函数可以得到该句柄。对其它应用程序的窗口来说,可以调用系统API函数查找窗口并得到相应窗口的句柄。如果应用程序要邮寄PowerBuilder定义事件(包括预定义事件和用户定义事件),那么使用PostEvent()函数既简单有方便。当应用程序在long参数位置指定一个字符串时,Post()函数复制一个该字符串的副本,然后将副本的地址传送给指定窗口。

    其它类库24552017-12-30
  •  <?php class Cache {     private $dir = "data/cache/";//定义缓存目录     private $key='c_a_sss'; // 文件名 md5加密 密钥     function set_dir($dirpath)     {         $this->dir=$dirpath;         $this->make_dir($this->dir);     }     function read($key,$minutes=1)     {         $filename=$this->get_filename($key);         if($datas = @file_get_contents($filename))         {             $datas = unserialize($datas);             if(time() - $datas['time'] < $minutes*60)             {                 return $datas['data'];             }         }         return false;     }缓存就是数据交换的缓冲区(称作Cache),当某一硬件要读取数据时,会首先从缓存中查找需要的数据,如果找到了则直接执行,找不到的话则从内存中找。由于缓存的运行速度比内存快得多,故缓存的作用就是帮助硬件更快地运行因为缓存往往使用的是RAM(断电即掉的非永久储存),所以在用完后还是会把文件送到硬盘等存储器里永久存储。电脑里最大的缓存就是内存条了,最快的是CPU上镶的L1和L2缓存,显卡的显存是给显卡运算芯片用的缓存,硬盘上也有16M或者32M的缓存。

    其它类库16932017-12-30
  • <?php header("content-type:text/html;charset=utf-8"); class DBUtils{     /**      *通用更新方法 insert update delete 操作      *@param sql      *@return bool  true false      */     public function update($sql){         $link = $this->getConn();         mysql_query($sql);         //如果出错显示         if(DEBUG){             echo mysql_error();         }         $rs = mysql_affected_rows($link);         $rs = $rs > 0;         mysql_close($link);         return $rs;     }MySQL 是一个关系型数据库,由瑞典 MySQL AB 公司开发,目前属于 Oracle 旗下公司。MySQL 最流行的关系型数据库管理系统,在 WEB 应用方面 MySQL 是最好的 RDBMS (Relational Database Management System,关系数据库管理系统) 应用软件之一。MySQL 是一种关联数据库管理系统,关联数据库将数据保存在不同的表中,而不是将所有数据放在一个大仓库内,这样就增加了速度并提高了灵活性。MySQL 所使用的 SQL 语言是用于访问数据库的最常用标准化语言。MySQL 软件采用了双授权政策(本词条"授权政策"),它分为社区版和商业版,由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,一般中小型网站的开发都选择 MySQL 作为网站数据库。由于其社区版的性能卓越,搭配 PHP ,Linux和 Apache 可组成良好的开发环境,经过多年的web技术发展,在业内被广泛使用的一种web服务器解决方案之一,称之为LAMP。

    其它类库27872017-12-30
  • <?php namespace App\Model\Database; class Config {     public $dsn;     public $user;     public $password;     /**      * @var string 分库分表后得到的数据库名      */     public $dbname;     /**      * @var string 分库分表后得到的表名      */     public $table;     /**      * @var array MySQL 配置数组      */     private static $config;     /**      * @var string 配置文件路径      */     private static $configFile = 'mysql.php';这是一个非常好用的MySQL分库分表的PHP类,需要的朋友可以下载使用,更多精彩尽在在PHP中文网。

    其它类库21522017-12-30
  • <?php  */ class UploadFile{   public $maxSize = -1;   // 是否支持多文件上传   public $supportMulti = true;   // 允许上传的文件后缀   //  留空不作后缀检查   public $allowExts = array();   // 允许上传的文件类型   // 留空不做检查   public $allowTypes = array();   // 使用对上传图片进行缩略图处理   public $thumb   =  false;   // 缩略图最大宽度   public $thumbMaxWidth;   // 缩略图最大高度图片上传在我们在项目中经常用到,几乎没有任何一个项目可以脱离图片或者是文件上传。这次给大家带来的就是一个好用的文件和图片上传PHP类

    其它类库23552017-12-29