首頁 > 下載 >  類別庫下載

  • <?php use phpFastCache\CacheManager; // Include composer autoloader require '../vendor/autoload.php'; $InstanceCache = CacheManager::getInstance('apc'); /**  * Try to get $products from Caching First  * product_page is "identity keyword";  */ $key = "product_page"; $CachedString = $InstanceCache->get($key); if (is_null($CachedString)) {     $CachedString = "APC Cache --> Cache Enabled --> Well done !";     // Write products to Cache in 10 minutes with same keyword     $InstanceCache->set($key, $CachedString, 600);     echo "FIRST LOAD // WROTE OBJECT TO CACHE // RELOAD THE PAGE AND SEE // ";     echo $CachedString; } else {     echo "READ FROM CACHE // ";     echo $CachedString; } echo '<br /><br /><a href="/">Back to index</a>&nbsp;--&nbsp;<a href="/' . basename(__FILE__) . '">Reload</a>';php快取技術是在開發過程中非常的常用和重要,快取技術可減輕伺服器負載、降低網路擁塞、增強www可擴展性,其基本思想是利用客戶訪問的時間局部性,將客戶訪問過的內容在Cache中存放一個副本,當該內容下次被訪問時,不必連接到駐留網站,phpfastcachePHP快取庫就是這麼一個快取類別庫

    快取庫47362017-12-22
  • <?php namespace CacheTool; use CacheTool\Code; class CodeTest extends \PHPUnit_Framework_TestCase {     public function testFactory()     {         $code = Code::fromString('return true;');         $this->assertSame('return true;', $code->getCode());     }     public function testAddStatement()     {         $code = new Code();         $code->addStatement('$a = 10;');         $this->assertSame('$a = 10;', $code->getCode());         $code->addStatement('return $a;');         $this->assertSame("$a = 10;\nreturn $a;", $code->getCode());     }     public function testWriteTo()     {php快取技術是在開發過程中非常的常用和重要,快取技術可減輕伺服器負載、降低網路擁塞、增強www可擴展性,其基本思想是利用客戶訪問的時間局部性,將客戶訪問過的內容在Cache中存放一個副本,當該內容下次被訪問時,不必連接到駐留網站,而是由Cache中保留的副本提供。 PHPcachetool清除APC_opcode快取庫就是這麼一個函式庫。

    快取庫47772017-12-22
  • <?php namespace DMS\Filter; /**  * Filter Object, responsible for retrieving the filtering rules  * for the object and applying them  *  * @package DMS  * @subpackage Filter  *  */ use DMS\Filter\Filters\Loader\FilterLoaderInterface; /**  * Class Filter  *  * Executor, receives objects that need filtering and executes attached rules.  *  * @package DMS\Filter  */ class Filter implements FilterInterface {     /**      *      * @var Mapping\ClassMetadataFactory      */     protected $metadataFactory;     /**      * @var FilterLoaderInterface      */     protected $filterLoader;     /**      * Constructor      *      * @param Mapping\ClassMetadataFactory $metadataFactory      * @param FilterLoaderInterface $filterLoader      */     public function __construct(Mapping\ClassMetadataFactory $metadataFactory, $filterLoader)     {         $this->metadataFactory = $metadataFactory;         $this->filterLoader    = $filterLoader;     }在PHP中,有些很有用的函數開源非常方便的防止你的網站遭受各種攻擊,例如SQL注入攻擊,XSS(Cross Site Scripting:跨站腳本)攻擊等。 dms-filter的php過濾函式庫就是一個防止別人惡意攻擊你的過濾函式庫,有需要的朋友可以下載使用。

    其它類別庫19052017-12-22
  • #!/usr/bin/env php <?php /*  * This file is part of Composer.  *  * (c) Nils Adermann <naderman@naderman.de>  *     Jordi Boggiano <j.boggiano@seld.be>  *  * For the full copyright and license information, please view  * the license that is located at the bottom of this file.  */ // Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264 if (extension_loaded('apc') && ini_get('apc.enable_cli') && ini_get('apc.cache_by_default')) {     if (version_compare(phpversion('apc'), '3.0.12', '>=')) {         ini_set('apc.cache_by_default', 0);     } else {         fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);         fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);     } } Phar::mapPhar('composer.phar'); require 'phar://composer.phar/bin/composer';輕量級的函式庫著重於減少開發的複雜度,相應的它的處理能力便有所減弱(如事務功能弱、不具備分散式處理能力),比較適用於開發中小型企業應用。

    其它類別庫21122017-12-22
  • #!/usr/bin/env php <?php /*  * This file is part of Composer.  *  * (c) Nils Adermann <naderman@naderman.de>  *     Jordi Boggiano <j.boggiano@seld.be>  *  * For the full copyright and license information, please view  * the license that is located at the bottom of this file.  */ // Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264 if (extension_loaded('apc') && ini_get('apc.enable_cli') && ini_get('apc.cache_by_default')) {     if (version_compare(phpversion('apc'), '3.0.12', '>=')) {         ini_set('apc.cache_by_default', 0);     } else {         fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);         fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);     } } Phar::mapPhar('composer.phar'); require 'phar://composer.phar/bin/composer'; __HALT_COMPILER(); ?>composer 是PHP依賴管理工具,PHP最低版本要求5.3.2,需要允許openssl擴展,編譯時加參數--with-openssl

    其它類別庫20182017-12-22
  • <?php namespace Collections; interface ConstCollectionInterface extends \Countable {     /**      * Verifies whether a collection is empty      * @return bool Returns TRUE if the collection is empty; FALSE otherswise.      */     public function isEmpty(); }我們知道,PHP 語言最重要的特性之一就是陣列了(特別是關聯陣列)。 PHP 為此也提供不少的函數和類別介面方便於陣列操作,但沒有一個集大成的類別專門用來操作陣列。 如果陣列運算不多的話,個別函數用起來會比較靈活,開銷也小。 但是,如果經常操作數組,尤其是對數組進行各種操作如排序、入棧、出隊列、翻轉、迭代等,系統函數用起來可能就沒有那麼優雅了。 今天就來跟大家介紹一下操作陣列的collectionsPHP的集合抽象函式庫。

    其它類別庫14122017-12-22
  • <?php namespace Cake\Collection; use ArrayIterator; use InvalidArgumentException; use IteratorIterator; use LogicException; use Serializable; use Traversable; class Collection extends IteratorIterator implements CollectionInterface, Serializable {     use CollectionTrait;     /**      * Constructor. You can provide an array or any traversable object      *      * @param array|\Traversable $items Items.      * @throws \InvalidArgumentException If passed incorrect type for items.      */     public function __construct($items)     {         if (is_array($items)) {             $items = new ArrayIterator($items);         }         if (!($items instanceof Traversable)) {             $msg = 'Only an array or \Traversable is allowed for Collection';             throw new InvalidArgumentException($msg);         }         parent::__construct($items);     }這是取得一個集合的語法和取得資料庫的集合庫,一個集合相當於一張表。

    其它類別庫19212017-12-22
  • <?php namespace Cake\Cache; use BadMethodCallException; use Cake\Core\App; use Cake\Core\ObjectRegistry; use RuntimeException; class CacheRegistry extends ObjectRegistry {     /**      * Resolve a cache engine classname.      *      * Part of the template method for Cake\Core\ObjectRegistry::load()      *      * @param string $class Partial classname to resolve.      * @return string|false Either the correct classname or false.      */     protected function _resolveClassName($class)     {         if (is_object($class)) {             return $class;         }         return App::className($class, 'Cache/Engine', 'Engine');     }快取就是資料交換的緩衝區(稱為Cache),當某一硬體要讀取資料時,會先從快取中尋找需要的數據,如果找到了則直接執行,找不到的話則從內存中找。由於快取的運作速度比記憶體快得多,故快取的作用就是幫助硬體更快運作。 因為快取往往使用的是RAM(斷電即掉的非永久儲存),所以在用完後還是會把檔案送到硬碟等記憶體永久儲存。電腦裡最大的快取就是記憶體條了,最快的是CPU上鑲的L1和L2緩存,顯示卡的顯卡是給顯示卡運算晶片用的緩存,硬碟上也有16M或是32M的快取。

    快取庫49512017-12-22
  • <?php if (!isset($argv)) {     fprintf(STDERR, "Must be run on command line");     exit(1); } if (!isset($argv[1])) {     fprintf(STDERR, "USAGE: %s source1 [source2...]" . PHP_EOL, $argv[0]);     exit(2); } fwrite(STDOUT, "<?php" . PHP_EOL); foreach (array_slice($argv, 1) as $file) {     fwrite(STDOUT, "require __DIR__ . '/$file';" . PHP_EOL); }資料結構是電腦儲存、組織資料的方式。資料結構是指相互之間存在一種或多種特定關係的資料元素的集合。通常情況下,精心選擇的資料結構可以帶來更高的運作或儲存效率。資料結構往往與高效率的檢索演算法和索引技術有關。

    其它類別庫17532017-12-22
  • <?php namespace Valitron; /**  * Validation Class  *  * Validates input against certain criteria  *  * @package Valitron  * @author  Vance Lucas <vance@vancelucas.com>  * @link    http://www.vancelucas.com/  */ class Validator {    public function __construct($data = array(), $fields = array(), $lang = null, $langDir = null)     {         // Allows filtering of used input fields against optional second array of field names allowed         // This is useful for limiting raw $_POST or $_GET data to only known fields         $this->_fields = !empty($fields) ? array_intersect_key($data, array_flip($fields)) : $data;         // set lang in the follow order: constructor param, static::$_lang, default to en         $lang = $lang ?: static::lang();         // set langDir in the follow order: constructor param, static::$_langDir, default to package lang dir         $langDir = $langDir ?: static::langDir();         // Load language file in directory         $langFile = rtrim($langDir, '/') . '/' . $lang . '.php';         if (stream_resolve_include_path($langFile) ) {             $langMessages = include $langFile;             static::$_ruleMessages = array_merge(static::$_ruleMessages, $langMessages);         } else {             throw new \InvalidArgumentException("Fail to load language file '" . $langFile . "'");         }     }驗證(Verification)是資訊術語,編譯過程的一部分,在該過程中,對程式碼進行檢查,看是否與定義的特定規則集一致,以允許檢驗某些安全要求。 公共語言運行庫可以驗證Microsoft中間語言(MSIL)。 伺服器端驗證就是當表單提交後,在伺服器端透過JAVA,等伺服器端程式碼對客戶輸入進行驗證。

    其它類別庫18482017-12-21
  • <?php /**  * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)  * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)  *  * Licensed under The MIT License  * For full copyright and license information, please see the LICENSE.txt  * Redistributions of files must retain the above copyright notice.  *  * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)  * @link          https://cakephp.org CakePHP(tm) Project  * @since         3.0.0  * @license       https://opensource.org/licenses/mit-license.php MIT License  */ namespace Cake\Validation; /**  * Describes objects that can be validated by passing a Validator object.  */ interface ValidatableInterface {     /**      * Validates the internal properties using a validator object and returns any      * validation errors found.      *      * @param \Cake\Validation\Validator $validator The validator to use when validating the entity.      * @return array      */     public function validate(Validator $validator); }驗證(Verification)是資訊術語,編譯過程的一部分,在該過程中,對程式碼進行檢查,看是否與定義的特定規則集一致,以允許檢驗某些安全要求。 公共語言運行庫可以驗證Microsoft中間語言(MSIL)。 伺服器端驗證就是當表單提交後,在伺服器端透過JAVA,等伺服器端程式碼對客戶輸入進行驗證。

    其它類別庫16182017-12-21
  • <?php namespace Respect\Validation; use ReflectionClass; use Respect\Validation\Exceptions\ComponentException; class Factory {     protected $rulePrefixes = ['Respect\Validation\Rules\'];     public function getRulePrefixes()     {         return $this->rulePrefixes;     }     private function filterRulePrefix($rulePrefix)     {         $namespaceSeparator = '\';         $rulePrefix = rtrim($rulePrefix, $namespaceSeparator);         return $rulePrefix.$namespaceSeparator;     }     public function appendRulePrefix($rulePrefix)     {         array_push($this->rulePrefixes, $this->filterRulePrefix($rulePrefix));     }     public function prependRulePrefix($rulePrefix)     {         array_unshift($this->rulePrefixes, $this->filterRulePrefix($rulePrefix));     }Validation-1.1PHP驗證庫是一個非常好用的驗證庫#驗證(Verification)是資訊術語,編譯過程的一部分,在該過程中,對程式碼進行檢查,看是否與定義的特定規則集一致,以允許檢驗某些安全要求。 公共語言運行庫可以驗證Microsoft中間語言(MSIL)。 伺服器端驗證就是當表單提交後,在伺服器端透過JAVA,等伺服器端程式碼對客戶輸入進行驗證。

    其它類別庫24032017-12-21