> 다운로드 >  라이브러리 다운로드

  • <?php function xml2array($contents, $get_attributes = 1, $priority = 'tag') {   if (!$contents) return array();   if (!function_exists('xml_parser_create')) {     // print "'xml_parser_create()' function not found!";     return array();   }   // Get the XML parser of PHP - PHP must have this module for the parser to work   $parser = xml_parser_create('');   xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8"); // http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss   xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);   xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);   xml_parse_into_struct($parser, trim($contents), $xml_values);   xml_parser_free($parser);   if (!$xml_values) return; //Hmm...   // Initializations   $xml_array = array();   $parents = array();   $opened_tags = array();   $arr = array();   $current = &$xml_array; //Refference   // Go through the tags.   $repeated_tag_index = array(); //Multiple tags with same name will be turned into an array   foreach($xml_values as $data) {     unset($attributes, $value); //Remove existing values, or there will be trouble     // This command will extract these variables into the foreach scope     // tag(string), type(string), level(int), attributes(array).     extract($data); //We could use the array by itself, but this cooler.     $result = array();     $attributes_data = array();     if (isset($value)) {       if ($priority == 'tag') $result = $value;       else $result['value'] = $value; //Put the value in a assoc array if we are in the 'Attribute' mode     }XML과 데이터 형식을 변환할 수 있는 클래스 라이브러리입니다. 필요한 친구는 다운로드하여 사용할 수 있습니다.

    기타 도서관17052017-12-26
  • <? class FileUtil {   /**    * 建立文件夹    *    * @param string $aimUrl    * @return viod    */   function createDir($aimUrl) {     $aimUrl = str_replace('', '/', $aimUrl);     $aimDir = '';     $arr = explode('/', $aimUrl);     foreach ($arr as $str) {       $aimDir .= $str . '/';       if (!file_exists($aimDir)) {         mkdir($aimDir);       }     }   } * 파일 클래스 조작 * 예: * FileUtil::createDir('a/1/2/3') ; b 폴더의 내용을 해당 폴더에 복사합니다. * FileUtil:: copyFile('b/1/2/3.exe','b/b/3.exe'); 파일 복사를 테스트하여 b/b 폴더를 만들고 b/1/2 폴더에 3.exe 파일을 복사합니다. into it * FileUtil::moveDir('a/','b/c'); b/c 파일 폴더 생성을 위해 폴더 이동을 테스트하고 a 폴더 아래의 내용을 해당 폴더로 이동한 후 a 폴더를 삭제합니다 * FileUtil::moveFile('b/1/2/3.exe','b/d/3.exe'); 파일 이동 테스트 b/d 폴더를 만들고 b/1/2에 있는 3.exe를 해당 폴더로 이동합니다. * FileUtil::unlinkFile('b/d/3.exe'); 파일 삭제 테스트 b/d /3.exe 파일 삭제 * FileUtil::unlinkDir('d');

    기타 도서관16412017-12-26
  • <?php class Params {   public $get = array();   public $post = array();   function __construct()   {     if (!empty($_GET)) {       foreach ($_GET as $key => $val) {         if (is_numeric($val)) {           $this->get[$key] = $this->getInt($val);         } else {           $this->get[$key] = $this->getStr($val);         }       }     }     if (!empty($_POST)) {       foreach ($_POST as $key => $val) {         if (is_numeric($val)) {           $this->post[$key] = $this->getInt($val);         } else {           $this->post[$key] = $this->getStr($val);         }       }     }   }이것은 준비된 문과 매개변수화된 쿼리를 사용하는 PHP 보안 라이브러리입니다. 매개변수가 포함된 SQL 문은 데이터베이스 서버로 전송되어 구문 분석됩니다! 공격자가 악의적으로 SQL을 삽입하는 것은 불가능합니다!

    기타 도서관21002017-12-26
  • <?php class DBManage {   var $db; // 数据库连接   var $database; // 所用数据库   var $sqldir; // 数据库备份文件夹   var $record;   // 换行符   private $ds = "n";   // 存储SQL的变量   public $sqlContent = "";   // 每条sql语句的结尾符   public $sqlEnd = ";";   /**    * 初始化    *    * @param string $host    * @param string $username    * @param string $password    * @param string $thisatabase    * @param string $charset    */설명: 볼륨 파일은 _v1.sql로 끝납니다. 기능: mysql 데이터베이스 볼륨 백업 구현, 백업할 테이블 선택, 단일 sql 파일 및 볼륨 sql import 구현: 1 데이터베이스 백업(내보내기)-- -------------------- ---- ---------//각각 호스트, 사용자 이름, 비밀번호, 데이터베이스 이름, 데이터베이스 인코딩입니다$db = new DBManage( 'localhost', 'root', 'root', 'test', 'utf8' );// 매개변수: 백업할 테이블(선택 사항), 백업 디렉터리(선택 사항, 기본값은 백업), 볼륨 크기(선택 사항, 기본값은 2000, 즉 2M) $ db->backup (); * ------2. 데이터베이스 복구(가져오기) ---------- --- -------------------------------------//호스트, 사용자 이름, 비밀번호입니다 각각 데이터베이스 이름, 데이터베이스 인코딩$db = new DBManage('localhost', 'root', 'root', 'test', 'utf8' );//매개변수: sql 파일

    기타 도서관21182017-12-26
  • <?php class db {         var $db;         var $position=0;         function sub_sql($str)         {                 global $prefix;                 return str_replace("detest_",$prefix,$str);         }         function Sql($str)         {                 $str=$this->sub_sql($str);                 $result = mysql_query($str);                 $i=0;                 while($row = mysql_fetch_array($result))                 {                         $str_array[$i]=$row;                         $i++;                 }                 if(empty($str_array))                 {                         $str_array=array();                 }                 $this->db=$str_array;         }친구들이 다운받아 사용할 수 있는 MYSQL 데이터베이스 운영 클래스입니다.

    기타 도서관17312017-12-26
  • <?php use PHPImageWorkshop\ImageWorkshop as ImageWorkshop; require_once(__DIR__.'/autoload.php'); class ImageWorkshopTest extends \PHPUnit_Framework_TestCase { ===================================================================================          const IMAGE_SAMPLE_PATH = '/Resources/images/sample1.jpg';     const FONT_SAMPLE_PATH  = '/Resources/fonts/arial.ttf';     const WEB_PATH          = 'http://localhost:8000';     public function testInitFromPath()     {         // test 1                  $layer = ImageWorkshop::initFromPath(__DIR__.static::IMAGE_SAMPLE_PATH);                  $this->assertTrue(is_object($layer) === true, 'Expect $layer to be an object');         $this->assertTrue(get_class($layer) === 'PHPImageWorkshop\Core\ImageWorkshopLayer', 'Expect $layer to be an ImageWorkshopLayer object');         // test 2         $layer = ImageWorkshop::initFromPath('file://'.__DIR__.static::IMAGE_SAMPLE_PATH);         $this->assertTrue(is_object($layer) === true, 'Expect $layer to be an object');         $this->assertTrue(get_class($layer) === 'PHPImageWorkshop\Core\ImageWorkshopLayer', 'Expect $layer to be an ImageWorkshopLayer object');         // test 3         if (version_compare(PHP_VERSION, '5.4', '>=')) {             $layer = ImageWorkshop::initFromPath(static::WEB_PATH.'/sample1.jpg');             $this->assertTrue(is_object($layer) === true, 'Expect $layer to be an object');             $this->assertTrue(get_class($layer) === 'PHPImageWorkshop\Core\ImageWorkshopLayer', 'Expect $layer to be an ImageWorkshopLayer object');         }이 라이브러리의 장점. ㅋㅋㅋ 기타 이미지 처리 라이브러리에서 지원하는 API는 기본적으로 지원됩니다

    기타 도서관23002017-12-25
  • <?php namespace Stampie; /**  * @author Christophe Coevoet <stof@notk.org>  */ interface IdentityInterface {     /**      * @return string      */     public function getEmail();     /**      * @return string|null      */     public function getName(); }이 클래스 라이브러리는 phpmailer와 동일한 기능을 가지고 있지만 phpmailer보다 성능이 더 좋으며 특히 첨부 파일 처리 능력이 뛰어나고 이메일을 성공적으로 보낼 확률도 높습니다.

    기타 도서관18212017-12-25
  • <?php namespace Stampie; class Identity implements IdentityInterface {     private $email;     private $name;     public function __construct($email = null, $name = null)     {         $this->email = $email;         $this->name = $name;     }     public function setEmail($email)     {         $this->email = $email;         return $this;     }     public function getEmail()     {         return $this->email;     }파일 업로드는 프로젝트 개발에서 흔히 사용되는 기능이지만, 파일 업로드 과정이 상대적으로 번거롭기 때문에 이런 복잡한 코드를 작성해야 합니다. 각 개발에서 함수 작성의 어려움을 줄이고 개발 시간을 절약하기 위해 일반적으로 반복적으로 사용되는 코드 조각을 클래스로 캡슐화합니다. 이 클래스 라이브러리는 정말 편리한 라이브러리입니다.

    기타 도서관22872017-12-25
  • <?php require_once __DIR__.'/../vendor/autoload.php'; use Gregwar\Captcha\CaptchaBuilder; $tests = 10000; $passed = 0; shell_exec('rm passed*.jpg'); for ($i=0; $i<$tests; $i++) {     echo "Captcha $i/$tests... ";     $captcha = new CaptchaBuilder;     $captcha         ->setDistortion(false)         ->build()     ;     if ($captcha->isOCRReadable()) {         $passed++;         $captcha->save("passed$passed.jpg");         echo "passed at ocr... ";     } else {         echo "failed... ";     }     echo "pass rate: ".round(100*$passed/($i+1),2)."%\n"; } echo "\n"; echo "Over, $passed/$tests readed with OCR\n";먼저 사용자 권한으로 모듈에 로그인할 때 인증코드를 사용하는 경우가 많습니다. 오늘은 나중에 사용할 수 있는 인증 코드 라이브러리를 추천하고 싶습니다. 인증 코드를 생성하는 단계는 대략 다음과 같습니다. 1) 임의의 문자열을 생성합니다. 2) 이미지(imagecreatetruecolor)를 생성한 다음 해당 문자열을 이미지(imagestring 또는 imagettftext)로 출력합니다. 일부 선이나 픽셀(imageline 및 imagesetpixel)을 추가하는 등 이미지의 노이즈를 방해합니다. 4) 출력 이미지(imagepng) 5) 이미지 리소스 삭제

    기타 도서관24382017-12-25
  • <?php        class QRbitstream {              public $data = array();                  //----------------------------------------------------------------------         public function size()         {             return count($this->data);         }                  //----------------------------------------------------------------------         public function allocate($setLength)         {             $this->data = array_fill(0, $setLength, 0);             return 0;         }              //----------------------------------------------------------------------         public static function newFromNum($bits, $num)         {             $bstream = new QRbitstream();             $bstream->allocate($bits);                          $mask = 1 << ($bits - 1);             for($i=0; $i<$bits; $i++) {                 if($num & $mask) {                     $bstream->data[$i] = 1;                 } else {                     $bstream->data[$i] = 0;                 }                 $mask = $mask >> 1;             }             return $bstream;         }이 QR 코드 생성 라이브러리는 사용하기 매우 쉽습니다. 물론 PHP 환경에서는 GD2 지원이 활성화되어야 합니다. 이 라이브러리는 $text 매개변수가 두 자리 정보 텍스트의 생성을 나타내는 주요 png() 메소드를 제공합니다. 매개변수 $outfile은 QR 코드 이미지 파일을 출력할지 여부를 나타내며, 기본값은 no입니다. L(QR_ECLEVEL_L, 7%), M(QR_ECLEVEL_M, 15%), Q(QR_ECLEVEL_Q, 25%), H(QR_ECLEVEL_H, 30%)의 적용 영역도 식별할 수 있습니다. ) 매개변수 $size는 생성된 이미지의 크기를 나타냅니다. 기본값은 3입니다. 매개변수 $margin은 QR 코드 주변의 공백 영역 값을 나타냅니다. QR코드를 찍어서 보여주세요.

    기타 도서관21702017-12-25
  • <?php  *  * @author    Colin Verot <colin@verot.net>  * @license   http://opensource.org/licenses/gpl-license.php GNU Public License  * @copyright Colin Verot  */ class upload {     /**      * Class version      *      * @access public      * @var string      */     var $version;     /**      * Uploaded file name      *      * @access public      * @var string      */     var $file_src_name;     /**      * Uploaded file name body (i.e. without extension)      *      * @access public      * @var string      */파일 업로드는 프로젝트 개발에서 흔히 사용되는 기능이지만, 파일 업로드 과정이 상대적으로 번거롭기 때문에 이런 복잡한 코드를 작성해야 합니다. 각 개발에서 함수 작성의 어려움을 줄이고 개발 시간을 절약하기 위해 일반적으로 반복적으로 사용되는 코드 조각을 클래스로 캡슐화합니다. 이 클래스 라이브러리는 정말 편리한 라이브러리입니다.

    기타 도서관19282017-12-23
  • <?php namespace JasonGrimes; class Paginator {     const NUM_PLACEHOLDER = '(:num)';     protected $totalItems;     protected $numPages;     protected $itemsPerPage;     protected $currentPage;     protected $urlPattern;     protected $maxPagesToShow = 10;     protected $previousText = 'Previous';     protected $nextText = 'Next';     /**      * @param int $totalItems The total number of items.      * @param int $itemsPerPage The number of items per page.      * @param int $currentPage The current page number.      * @param string $urlPattern A URL for each page, with (:num) as a placeholder for the page number. Ex. '/foo/page/(:num)'      */     public function __construct($totalItems, $itemsPerPage, $currentPage, $urlPattern = '')     {         $this->totalItems = $totalItems;         $this->itemsPerPage = $itemsPerPage;         $this->currentPage = $currentPage;         $this->urlPattern = $urlPattern;         $this->updateNumPages();     }기능 1: 총 페이지 수, 현재 페이지, 페이지 그룹화 및 URL(페이지 수, 현재 페이지, 페이지당 수, 링크 주소)을 기반으로 페이징 탐색 및 페이징 기능 매개변수 목록을 생성합니다. 기능 2: 레코드 수에 따라 페이지 열이 계산됩니다. $page, 현재 페이지, $row_num 총 레코드 수, $pagesize: 페이지당 레코드 수.

    페이지 매김 라이브러리96592017-12-23