Home > Download >  Library download

  • <?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;   } }This is a PHP class for intercepting strings. Friends who need it can download it and use it.

    Other libraries19872017-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;         }     }This is a mobile phone number and IP address class obtained by php. Friends who need it can download and use

    Other libraries30052017-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:This is a PHP-encapsulated image upload class. Friends who need it can download and use it

    Other libraries29362017-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=This is a php attachment email class, friends who need it can download and use

    Other libraries21722017-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;This is a PHP parameter data filtering security class. Friends who need it can download and use

    Other libraries22132017-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. Find a page2. Filter all img3. Filter out all src attributes4. Get link information, Write files file_get_contents(), file_put_contents()5. Run the code in cli mode (the browser may run out of memory or run timeout)

    Other libraries21942017-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"]);     }The cache is the buffer for data exchange. When a piece of hardware wants to read data, it will first search the required data from the cache. If it is found, it will be executed directly. If it is not found, it will be searched from the memory. Since cache runs much faster than memory, the purpose of the cache is to help the hardware run faster. Because cache often uses RAM, the files will still be sent to storage such as hard disks for permanent storage after use. The largest cache in a computer is the memory stick. The fastest ones are the L1 and L2 caches built into the CPU. The video memory of the graphics card is a cache for the graphics card's computing chip. There is also a 16M or 32M cache on the hard disk.

    Other libraries19342017-12-30
  • The <?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() function is used to send non-PowerBuilder predefined event messages to the window. This window can be the window of the PowerBuilder application or the window of other applications. The Post() function places the sent message at the end of the specified window message queue and then returns it to the application. It does not wait for the execution of the corresponding event handler. This is different from the Send() function. The Send() function directly triggers the corresponding event of the specified window and returns to the calling application after executing the event handler. Therefore, we say that the Post() function uses an asynchronous method, and the Send() function uses a synchronous method. The parameter handle of the Post() function specifies the window handle for receiving the message. For the PowerBuilder window, the handle can be obtained using the Handle() function. For windows of other applications, you can call the system API function to find the window and get the handle of the corresponding window. If the application wants to post PowerBuilder defined events (including predefined events and user-defined events), then using the PostEvent() function is simple and convenient. When the application specifies a string in the long parameter position, the Post() function makes a copy of the string and then transmits the address of the copy to the specified window.

    Other libraries24552017-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;     }The cache is the buffer for data exchange (called Cache). When a piece of hardware wants to read data, it will first search for the required data from the cache. If it is found, it will be executed directly. If it cannot be found, it will be executed from the cache. Search in memory. Since the cache runs much faster than the memory, the role of the cache is to help the hardware run fasterBecause the cache often uses RAM (non-permanent storage that is lost when power is turned off), so when it is used up In the end, the files will still be sent to storage such as hard drives for permanent storage. The largest cache in a computer is the memory stick. The fastest ones are the L1 and L2 caches built into the CPU. The video memory of the graphics card is a cache for the graphics card's computing chip. There is also a 16M or 32M cache on the hard disk.

    Other libraries16932017-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 is a relational database developed by the Swedish MySQL AB company and currently belongs to Oracle. MySQL is the most popular relational database management system. In terms of WEB applications, MySQL is one of the best RDBMS (Relational Database Management System) application software. MySQL is a relational database management system that stores data in different tables instead of putting all the data in one big warehouse, which increases speed and flexibility. The SQL language used by MySQL is the most commonly used standardized language for accessing databases. MySQL software adopts a dual authorization policy (this entry "Authorization Policy"), which is divided into community version and commercial version. Due to its small size, fast speed and low total cost of ownership, especially the characteristics of open source, it is generally used by small and medium-sized users. For website development, MySQL is chosen as the website database. Due to the excellent performance of its community version, it can form a good development environment with PHP, Linux and Apache. After years of web technology development, it has become one of the widely used web server solutions in the industry, called LAMP.

    Other libraries27862017-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';This is a very easy-to-use PHP class for MySQL sub-database and table. Friends who need it can download and use it. More exciting things can be found on the PHP Chinese website.

    Other libraries21522017-12-30
  • <?php  */ class UploadFile{   public $maxSize = -1;   // 是否支持多文件上传   public $supportMulti = true;   // 允许上传的文件后缀   //  留空不作后缀检查   public $allowExts = array();   // 允许上传的文件类型   // 留空不做检查   public $allowTypes = array();   // 使用对上传图片进行缩略图处理   public $thumb   =  false;   // 缩略图最大宽度   public $thumbMaxWidth;   // 缩略图最大高度Image uploading is often used in our projects. There is almost no project that can be separated from image or file uploading. What I bring to you this time is a useful PHP class for uploading files and images

    Other libraries23542017-12-29