首頁 > 下載 >  類別庫下載

  • <?php error_reporting(E_ALL | E_STRICT); // Ensure that composer has installed all dependencies if (!file_exists(dirname(__DIR__) . DIRECTORY_SEPARATOR . '/vendor/autoload.php')) {     die("Dependencies must be installed using composer:\n\nphp composer.phar install --dev\n\n"         . "See http://getcomposer.org for help with installing composer\n"); } // Include the Composer autoloader $loader = include realpath(dirname(__FILE__) . '/../vendor/autoload.php');在PHP裡提供了大數字的操作類,有的類別是用於高精度計算,其中BigInteger類是針對大整數的處理類,而BigDecimal類則是針對大小數的處理類。下邊我們介紹BigDecimal類別:BigDecimal 的實作利用到了BigInteger,不同的是BigDecimal加入了小數的概念。一般的float型和Double型資料只可以用來做科學計算或是工程計算,由於在商業計算中,要求的數字精度比較高,所以要用到java.math.BigDecimal類,它支援任何精度的定點數,可以用它來精確計算貨幣值。

    其它類別庫10472017-12-13
  • <?php require_once '../src/MischiefCollective/ColorJizz/Autoloader.php'; MischiefCollective\ColorJizz\Autoloader::register(); use MischiefCollective\ColorJizz\Formats\Hex; echo Hex::create(0x00096A)->toCIELCh()->toHex()->hue(230);這個類別是php轉換或處理顏色的類,可以把任意顏色轉換為其反色的方法。分享給大家供大家參考。 這段php程式碼可以把一個顏色變成與之相反的顏色編碼,如:白色變成黑色,藍色變成黃色

    其它類別庫10562017-12-13
  • <?php /*  * Copyright (C) 2016 Nicolas Grekas - p@tchwork.com  *  * This library is free software; you can redistribute it and/or modify it  * under the terms of the (at your option):  * Apache License v2.0 (http://apache.org/licenses/LICENSE-2.0.txt), or  * GNU General Public License v2.0 (http://gnu.org/licenses/gpl-2.0.txt).  */ /**  * Normalizer plugs Patchwork\PHP\Shim\Normalizer as a PHP implementation  * of intl's Normalizer when the intl extension in not enabled.  */ class Normalizer extends Patchwork\PHP\Shim\Normalizer { }UTF-8(8-bit Unicode Transformation Format)是一種針對Unicode的可變長度字元編碼,又稱萬國碼。由Ken Thompson於1992年創立。現在已經標準化為RFC 3629。 UTF-8用1到6個位元組編碼Unicode字元。用在網頁上可以統一頁面顯示中文簡體繁體及其它語言

    其它類別庫10502017-12-13
  • 测量单位:用于表示与其相比较的同 <?php namespace PhpUnitsOfMeasureTest; use PhpUnitsOfMeasure\UnitOfMeasure; class UnitOfMeasureTest extends \PHPUnit_Framework_TestCase {     /**      * @covers \PhpUnitsOfMeasure\UnitOfMeasure::__construct      * @covers \PhpUnitsOfMeasure\UnitOfMeasure::getName      */     public function testGetName()     {         $uom = new UnitOfMeasure(             'quatloos',             function ($valueInNativeUnit) {                 return $valueInNativeUnit;             },             function ($valueInThisUnit) {                 return $valueInThisUnit;             }         );         $this->assertEquals('quatloos', $uom->getName());     }種量大小的約定定義和採用的特定量。 中文名測量單位定   義約定定義與特定量單位符號m 又   名計量單位定義:用來表示與其相比較的同種量大小的約定定義和採用的特定量。 ①約定地賦予測量單位名稱和符號。如長度的單位名稱為米,單位符號為m。 ②同量綱的量即使這些量不是同種量,其單位可有相同的名稱和符號。如功、熱、能量,單位都是焦爾(J)。 ③測量單位在我國又稱計量單位。

    其它類別庫11252017-12-13
  • <?php namespace OAuth\Common; /**  * @author ieter Hordijk <info@pieterhordijk.com>  */ class AutoLoader {     /**      * @var string The namespace prefix for this instance.      */     protected $namespace = '';     /**      * @var string The filesystem prefix to use for this instance      */     protected $path = '';     /**      * Build the instance of the autoloader      *      * @param string $namespace The prefixed namespace this instance will load      * @param string $path      The filesystem path to the root of the namespace      */     public function __construct($namespace, $path)     {         $this->namespace = ltrim($namespace, '\');         $this->path      = rtrim($path, '/\') . DIRECTORY_SEPARATOR;     }OAUTH協定為使用者資源的授權提供了一個安全的、開放而又簡易的標準。同時,任何第三方都可以使用OAUTH認證服務,任何服務提供者都可以實現自身的OAUTH認證服務,因而OAUTH是開放的。業界提供了OAUTH的多種實作如PHP、JavaScript,Java,Ruby等各種語言開發包,大大節省了程式設計師的時間,因而OAUTH是簡易的。網路許多服務如Open API,許多大公司如穀歌,Yahoo,Microsoft等都提供了OAUTH認證服務,這些都足以說明OAUTH標準逐漸成為開放資源授權的標準。

    其它類別庫11352017-12-13
  • OAUTH協定為使用者資源的授權提供了一個安全的、開放而又簡易的標準。同時,任何第三方都可以使用OAUTH認證服務,任何服務提供者都可以實現自身的OAUTH認證服務,因而OAUTH是開放的。業界提供了OAUTH的多種實作如PHP、JavaScript,Java,Ruby等各種語言開發包,大大節省了程式設計師的時間,因而OAUTH是簡易的。網路許多服務如Open API,許多大公司如穀歌,Yahoo,Microsoft等都提供了OAUTH認證服務,這些都足以說明OAUTH標準逐漸成為開放資源授權的標準。

    其它類別庫9192017-12-13
  • <?php namespace Dflydev\Hawk\Client; use Dflydev\Hawk\Credentials\Credentials; use Dflydev\Hawk\Nonce\NonceProviderInterface; use Dflydev\Hawk\Time\TimeProviderInterface; class ClientTest extends \PHPUnit_Framework_TestCase {     /**      * @test      */     public function shouldCreateBewit()     {         $client = ClientBuilder::create()->build();         $tentTestVectorsCredentials = new Credentials(             'HX9QcbD-r3ItFEnRcAuOSg',             'sha256',             'exqbZWtykFZIh2D7cXi9dA'         );         $this->assertEquals(             'ZXhxYlpXdHlrRlpJaDJEN2NYaTlkQVwxMzY4OTk2ODAwXE8wbWhwcmdvWHFGNDhEbHc1RldBV3ZWUUlwZ0dZc3FzWDc2dHBvNkt5cUk9XA',             $client->createBewit(                 $tentTestVectorsCredentials,                 'https://example.com/posts',                 0,                 array(                     'timestamp' => 1368996800,                 )             )         );     } }超文本傳輸協定(HTTP,HyperText Transfer Protocol)是網路上應用最廣泛的一種網路協定。所有的WWW文件都必須遵守這個標準。設計HTTP最初的目的是為了提供一種發佈和接收HTML頁面的方法。 1960年美國人Ted Nelson構思了一種透過電腦處理文字訊息的方法,並稱之為超文本(hypertext),這成為了HTTP超文本傳輸協定標準架構的發展根基。 Ted Nelson組織協調萬維網協會(World Wide Web Consortium)和互聯網工程工作小組(Internet Engineering Task Force )共同合作研究,最終發布了一系列的RFC,其中著名的RFC 2616定義了HTTP 1.1。

    其它類別庫16112017-12-13
  • <?php include(dirname(__FILE__).'/../lib/emoji.php'); header('Content-type: text/plain; charset=UTF-8'); $GLOBALS['failures'] = 0; $test_unified= "Hello ".utf8_bytes(0x2649); $test_iphone= "Hello ".utf8_bytes(0xE240); $test_docomo= "Hello ".utf8_bytes(0xE647); $test_kddi= "Hello ".utf8_bytes(0xE490); $test_google= "Hello ".utf8_bytes(0xFE02C); $test_html= "Hello ".test_html(2649); is(emoji_docomo_to_unified($test_docomo),$test_unified, "DoCoMo -> Unified"); is(emoji_kddi_to_unified($test_kddi),$test_unified, "KDDI -> Unified"); is(emoji_softbank_to_unified($test_iphone),$test_unified, "Softbank -> Unified"); is(emoji_google_to_unified($test_google),$test_unified, "Google -> Unified"); echo "#------------------\n有時候我們得到表情字串想讓它對應的顯示表情,那這樣的話該怎麼做呢?前陣子就遇到了這方面的需求,在請求資料的時候,後台回傳的字串中包含:sad: 這類型的表情字串,如果直接將內容放到Label上顯示,那麼顯示的也是:sad:這樣的形式找了很多資料,發現都得用圖文混排的方式去處理,其中很多的表情字符串是[大哭]這樣的形式,然後對於:sad:這樣的形式就又有點懵逼了,後來用正規的方式去處理了,發現確實好用,同時也處理了tableviewCell的自適應高度問題。 emoji表情轉換PHP函式庫就完美的解決了這個問題

    其它類別庫22172017-12-13
  • 今天帶給大家在多台遠端機器上並行運行的命令列的PHP庫,我們下面來看一段程式碼。 <?php namespace League\Shunt; use League\Shunt\Contracts\SCPInterface; use League\Shunt\Contracts\SessionInterface; use League\Shunt\BaseObject; use Symfony\Component\Console\Output\OutputInterface; use RuntimeException; class SCP extends BaseObject implements SCPInterface {     protected $session;     public function __construct(SessionInterface $session, OutputInterface $output)     {         // Set the base object properties         parent::__construct($session, $output);         if ( ! $session->valid()) throw new RuntimeException('SSH connection failed.');         $this->session = $session;     }     public function put($localFile = '', $remoteFile = '')     {         return $this->doRun(__METHOD__, func_get_args(), ssh2_scp_send($this->session->getConnection(), $localFile, $remoteFile));     }     public function get($remoteFile = '', $localFile = '')     {         return $this->doRun(__METHOD__, func_get_args(), ssh2_scp_recv($this->session->getConnection(), $remoteFile, $localFile));     } }#

    其它類別庫11902017-12-12
  • 大家都知道,有很多方法可以進行標記解析,今天我們就帶來利用輕量級的標記來解析的PHP函式庫,一起來看看。 # <?php namespace Decoda; use Decoda\Decoda; use Decoda\Loader\FileLoader; use Decoda\Test\TestCase; use Decoda\Test\TestComponent; class ComponentTest extends TestCase {     protected function setUp() {         parent::setUp();         $this->object = new TestComponent(array('key' => 'value'));     }     public function testAddGetLoaders() {         $this->assertEquals(0, count($this->object->getLoaders()));         $this->object->addLoader(new FileLoader(TEST_DIR . '/config/test.php'));         $this->assertEquals(1, count($this->object->getLoaders()));     }     public function testGetSetConfig() {         $this->assertEquals('value', $this->object->getConfig('key'));         $this->assertEquals(null, $this->object->getConfig('foobar'));         $this->object->setConfig(array('key' => 'foo'));         $this->assertEquals('foo', $this->object->getConfig('key'));     }     public function testGetSetParser() {         $this->assertEquals(null, $this->object->getParser());         $this->object->setParser(new Decoda());         $this->assertInstanceOf('Decoda\Decoda', $this->object->getParser());     }     public function testMessage() {         $this->object->setParser(new Decoda());         $this->assertEquals('Quote by {author}', $this->object->message('quoteBy'));     } }

    其它類別庫10432017-12-12
  • 我們知道。命令是在作業系統中,提示進行命令輸入的一種工作提示符號。在不同的作業系統環境下,命令提示字元各不相同。在windows環境下,命令列程序為cmd.exe,是一個32位元的命令列程序,微軟Windows系統基於Windows上的命令解釋程序,類似微軟的DOS作業系統。輸入一些指令,cmd.exe可以執行,例如輸入shutdown -s就會在30秒後關機。總之,它非常有用。開啟方法:開始-所有程式-附件 或 開始-尋找-輸入:cmd/cmd.exe 回車。它也可以執行BAT檔案。這次小編給大家總結了一些簡單的命令列包裝的PHP庫,我們一起來看看。 <?php require_once __DIR__ . '/../vendor/autoload.php'; use MrRio\ShellWrap as sh; // List all files in current dir echo sh::ls(); // Touch a file to create it sh::touch('file.html');#

    其它類別庫13052017-12-12
  • cron規劃任務,是任務在約定的時間執行已經計畫好的工作,這是表面的意思。在Linux中,我們常用到 cron 伺服器來完成這項工作。 cron伺服器可以根據設定檔約定的時間來執行特定的作務。 <?php namespace Cron; abstract class AbstractField implements FieldInterface {     protected $fullRange = [];     protected $literals = [];     protected $rangeStart;     protected $rangeEnd;     public function __construct()     {         $this->fullRange = range($this->rangeStart, $this->rangeEnd);     }     public function isSatisfied($dateValue, $value)     {         if ($this->isIncrementsOfRanges($value)) {             return $this->isInIncrementsOfRanges($dateValue, $value);         } elseif ($this->isRange($value)) {             return $this->isInRange($dateValue, $value);         }         return $value == '*' || $dateValue == $value;     }

    其它類別庫11092017-12-12