ホームページ > ダウンロード >  クラスライブラリのダウンロード

  • <?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 形式とデータ形式の間で変換できるクラス ライブラリです。必要な友達はダウンロードして使用できます。

    その他の図書館17042017-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'); a/1 を作成するフォルダーの作成をテストします。 / 2/3 フォルダー * FileUtil::createFile('b/1/2/3'); # * FileUtil::createFile('b/1/2/3.exe'); テストファイルを作成します b/1/2/ フォルダーの下に 3.exe ファイルを作成します * FileUtil::copyDir ('b','d/e'); フォルダーをテスト コピーして d/e ファイルを作成しますフォルダーを作成し、b フォルダーの内容をそこにコピーします。 * FileUtil::copyFile('b/1/ 2/3.exe','b/b/3.exe'); ファイルのコピーをテストします。 b/b フォルダーを作成し、b/1/2 フォルダー内の 3.exe ファイルをそのフォルダーにコピーします* Fileutil :: moveir ('a/', 'b/c'); モバイル フォルダーをテストします。 B/C フォルダーを作成し、コンテンツを A フォルダーの下に移動し、A フォルダーを削除します ## * FileUtil::moveFile('b/1/2/3.exe','b/d/ 3.exe'); ファイルの移動をテストする b/d フォルダーを作成し、b/1/ Move 3.exe を 2 に配置します * FileUtil::unlinkFile('b/d/3.exe'); テストファイルの削除 b/d/3.exe ファイルを削除します * FileUtil::unlinkDir('d'); フォルダーの削除をテストします 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 file

    その他の図書館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 データベース操作クラスです。友人がダウンロードして使用できます。

    その他の図書館17302017-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');         }このライブラリの利点。 サムネイルの速度は非常に速く、品質は非常に高くなっていますスマート クロッピングをサポートGIF 画像の非常に優れたサポート5 つのサムネイル モード画像比較機能高度な画像フィルタリング機能画像ブレンディング他の画像処理ライブラリがサポートするAPIも基本的にサポート##

    その他の図書館22992017-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); 3) いくつかのラインまたはピクセル (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 サポートが有効になっている必要があります。このライブラリは key png() メソッドを提供しており、パラメータ $text は 2 桁の情報テキストの生成を示し、パラメータ $outfile は QR コード画像ファイルを出力するかどうかを示し、デフォルトは no です。パラメータ $level は次のことを示します。フォールト トレランス率、つまり、カバーされている領域も識別できます。L (QR_ECLEVEL_L、7%)、M (QR_ECLEVEL_M、15%)、Q (QR_ECLEVEL_Q、25%)、H (QR_ECLEVEL_H、30%) ); パラメータ $size は生成された画像のサイズを示し、デフォルトは 3; パラメータ $margin は QR コードの周囲の境界線の空白領域の間隔値を示します; パラメータ $saveandprint は、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: ページあたりのレコード数、$url レコード ページ。

    ページネーションライブラリ96592017-12-23