<?php /* * This file is part of DbUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\DbUnit; /** * An interface for classes that require a list of databases to operate. */ interface DatabaseListConsumer { /** * Sets the database for the spec * * @param array $databases */ public function setDatabases(array $databases); }uNIT (Understanding and Interaction Technology,理解與互動技術)平台,是由百度專注於中文第三方開發者打造的對話系統開發平台。 UNIT搭載業界領先的需求理解與對話管理技術,蘊含百度多年累積的自然語言理解與互動技術、深度學習、大數據等核心能力,可以讓智慧對話互動快速賦能第三方開發者的產品,讓未來更富想像空間。
<?php $autoloadFile = './vendor/codeception/codeception/autoload.php'; if (file_exists('./vendor/autoload.php') && file_exists($autoloadFile) && __FILE__ != realpath($autoloadFile)) { //for global installation or phar file fwrite( STDERR, "\n==== Redirecting to Composer-installed version in vendor/codeception ====\n" ); require $autoloadFile; //require package/bin instead of codecept to avoid printing hashbang line require './vendor/codeception/codeception/package/bin'; die; } elseif (file_exists(__DIR__ . '/vendor/autoload.php')) { // for phar require_once(__DIR__ . '/vendor/autoload.php'); } elseif (file_exists(__DIR__ . '/../../autoload.php')) { //for composer require_once __DIR__ . '/../../autoload.php'; }我們先設想這樣一個場景:當技術人員開發完畢, 其客戶, 產品經理, 或者是測試人員, 他們怎麼確定產品的可用性? 一般情況下, 他們都是執行以下幾個步驟進行測試: 開啟瀏覽器;輸入url;看到一些資訊, 並確定了這個頁面是可用的;點擊某個url; 填寫表單, 並提交表單, 看到了某些資訊, 並確定此功能是可用的這種測試方式我們稱之為 手動測試, 或 人工測試, 與其相反的是 自動化測試, Codeception 的 Acceptance Tests 會利用瀏覽器的程式介面, 做到以上的 手動測試 所涉及的步驟完全自動化, 大幅節省了人力成本.#
<?php declare(strict_types=1); $rootDir = realpath(__DIR__ . '/../'); // Autoloader for standalone install (installed via `composer create-project` or cloned locally) $autoloader = realpath($rootDir . '/vendor/autoload.php'); if (! $autoloader) { // Installed via `composer [global] require`. $autoloader = realpath($rootDir . '/../../autoload.php'); } if (! $autoloader) { throw new RuntimeException( 'ApiGen was unable to find its autoloader. ' . 'Did you forget to run "composer update"?' ); } require_once $autoloader;PhalApi 1.x 是經典封存版本,已停止更新,歷練考驗,放心使用。 主要採用PEAR命名規範,遵循PSR-0,不支援命名空間和composer。 PhalApi 1.x 支援PHP 5.3以上版本,並支援PHP 7。
<?php namespace GifCreator; /** * Create an animated GIF from multiple images * * @version 1.0 * @link https://github.com/Sybio/GifCreator * @author Sybio (Clément Guillemain / @Sybio01) * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @copyright Clément Guillemain */ class GifCreator { /** * @var string The gif string source (old: this->GIF) */ private $gif; /** * @var string Encoder version (old: this->VER) */ private $version; /** * @var boolean Check the image is build or not (old: this->IMG) */ private $imgBuilt;這個類別庫非常好用,你只需要先需要確認類別庫庫是否正常,如果是合成圖片,請確保把分解的圖片放在frames的資料夾裡面。啟動程式就可以得到你想要的GIF圖了。
<?php /** * PhpThumb Library Example File * This file contains example usage for the PHP Thumb Library * PHP Version 5 with GD 2.0+ * PhpThumb : PHP Thumb Library <http://phpthumb.gxdlabs.com> * Copyright (c) 2009, Ian Selby/Gen X Design * * Author(s): Ian Selby <ian@gen-x-design.com> * * Licensed under the MIT License * Redistributions of files must retain the above copyright notice. * * @author Ian Selby <ian@gen-x-design.com> * @copyright Copyright (c) 2009 Gen X Design * @link http://phpthumb.gxdlabs.com * @license http://www.opensource.org/licenses/mit-license.php The MIT License * @version 3.0 * @package PhpThumb * @subpackage Examples * @filesource */ require_once '../vendor/autoload.php'; $thumb = new PHPThumb\GD(__DIR__ .'/../tests/resources/test.jpg'); $thumb->adaptiveResize(175, 175); $thumb->show();在用php開發網站的時候,使用物件導向的方法確實可以提高程式碼重複使用率,減少程式碼冗餘。而對初學者更友善的是,PHP開發網站所需的大部分類庫,網路上都有十分優秀的類庫存在了。這次帶給大家的就是處理縮圖的PHP類庫,需要的朋友可以直接拿去使用。
var C = (function(){ // ------Class Creation------ var initializing = false, fnTest = /xyz/.test(function() { xyz; }) ? /\b_super\b/: /.*/; // The base Class implementation (does nothing) this.Class = function() {}; // Create a new Class that inherits from this class Class.extend = function(prop) { var _super = this.prototype; // Instantiate a base class (but only create the instance, // don't run the init constructor) initializing = true; var prototype = new this(); initializing = false;該類別庫主要依賴Simple JavaScript Inheritance ,並對其做了修改。
<?php undation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA echo "<h1>PHP QR Code</h1><hr/>"; //set it to writable location, a place for temp generated PNG files $PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR; //html PNG location prefix $PNG_WEB_DIR = 'temp/'; include "qrlib.php"; //ofcourse we need rights to create temp dir if (!file_exists($PNG_TEMP_DIR)) mkdir($PNG_TEMP_DIR); $filename = $PNG_TEMP_DIR.'test.png'; $errorCorrectionLevel = 'L'; if (isset($_REQUEST['level']) && in_array($_REQUEST['level'], array('L','M','Q','H'))) $errorCorrectionLevel = $_REQUEST['level']; $matrixPointSize = 4; if (isset($_REQUEST['size'])) $matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10);我們的這個二維碼產生類別首先需要您的PHP環境必須開啟支援GD2。它提供了一個關鍵的png()方法,其中參數$text表示生成二位的信息文本;參數$outfile表示是否輸出二維碼圖片文件,預設否;參數$level表示容錯率,也就是有被涵蓋的區域還能識別,分別是L(QR_ECLEVEL_L,7%),M(QR_ECLEVEL_M,15%),Q(QR_ECLEVEL_Q,25%),H(QR_ECLEVEL_H,30%); $size表示生成圖片大小,預設表示生成圖片大小,預設值表示生成圖片參數是3;參數$margin表示二維碼周圍邊框空白區域間距值;參數$saveandprint表示是否儲存二維碼並顯示。
<?php namespace ImageOptimizer\TypeGuesser; class ExtensionTypeGuesser implements TypeGuesser public function guess($filepath) { $ext = strtolower(pathinfo($filepath, PATHINFO_EXTENSION)); switch($ext) { case 'png': return self::TYPE_PNG; case 'gif': return self::TYPE_GIF; case 'jpg': case 'jpeg': return self::TYPE_JPEG; default: return self::TYPE_UNKNOWN; } } }操作影像:就是去掉不必要的顏色、像素等,例影像的由大變小。網頁圖像的要求是在盡可能短的傳輸時間裡,發布盡可能高品質的圖像。因此在設計和處理網頁圖像時就要求圖像有盡可能高的清晰度與盡可能小的尺寸,從而使圖像的下載速度達到最快。為此,必須對影像進行最佳化操作。 #
<?php include 'vendor/autoload.php'; use Sami\Sami; use Symfony\Component\Finder\Finder; $iterator = Finder::create() ->files() ->name('*.php') ->in($dir = 'src') ; return new Sami($iterator, array( 'title' => 'PHP-FFMpeg API', 'theme' => 'enhanced', 'build_dir' => __DIR__.'/docs/source/API/API', 'cache_dir' => __DIR__.'/docs/source/API/API/cache', 'default_opened_level' => 2, ));包裝為在流通過程中保護產品,方便儲運,促進銷售,按一定的技術方法所用的容器、材料和輔助物等的總體名稱;也指為達到上述目的在採用容器,材料和輔助物的過程中施加一定技術方法等的操作活動。承裝沒有進入流通領域物品的用品不能稱之為包裝,只能稱為「包裹」、「箱子」、「盒子」、」容器「等。因為包裝除了有包裹盒承裝的功能外,對物品進行修飾,獲得受眾的青睞才是包裝的重要作用。
<?php namespace Herrera\FileLocator\Tests; use Herrera\FileLocator\Collection; use Herrera\FileLocator\Locator\FileSystemLocator; use PHPUnit_Framework_TestCase as TestCase; use ReflectionProperty; class CollectionTest extends TestCase { /** * @var Collection */ private $collection; public function testAdd() { $locator = new FileSystemLocator(null); $this->collection->add($locator); $p = new ReflectionProperty($this->collection, 'locators'); $p->setAccessible(true); $this->assertTrue( $p->getValue($this->collection) ->contains($locator) ); return array($this->collection, $locator); }現有的行動通訊系統中行動定位服務主要用於緊急救援,如緊急救護,緊急呼叫場景下對使用者的定位;基於位置的資訊服務,如車載GPS的應用、黃頁、交通資訊、天氣資訊、導航資訊和導覽服務等;基於位置觸發的服務,如基於位置的管理資訊和計費等;追蹤及資產管理服務,如車輛調度/追蹤/監控/防盜、物資追蹤和老年兒童監護服務等。 LTE系統為了提供位置業務,引入了定位特性。對定位特性的主要需求是同時支援控制面定位過程和使用者面定位過程。控制面的定位主要是指透過控制訊號來進行定位相關的資訊的傳輸;使用者面的定位是指對OMA SUPL(Open Mobile Alliance Secure User Plane Location)協定的支持,即定位相關資訊可以透過OMA SUPL協定進行傳輸,在無線介面看其是用戶數據,不是控制信令。 定位方式分為支援基於網路(Network-based、E-SMLC-based)的定位方式和基於UE(UE-based)的定位方式。基於網路的定位方式是指UE的位置計算是在E-SMLC中進行;基於UE的定位方式是指UE的位置計算是在UE內進行。
string mime_content_type ( string $filename ) Returns the MIME content type for a file as determined by using information from the magic.mime file. <?php $mime_type = mime_content_type('1.jpg'); echo $mime_type; // image/jpeg ?>使用fileinfo需要安裝php_fileinfo擴充功能。 如已安裝可以在extension_dir目錄下找到php_fileinfo.dll(windows),fileinfo.so(linux)開啟php.ini,把extension=php_fileinfo.dll前的";"去掉,然後重啟apache。 使用exif_imagetype方法需要安裝php_exif擴展,並需要安裝php_mbstring擴展如已安裝可以在extension_dir目錄下找到php_exif.dll(windows),exif.so(linux)#開啟php.ini,把extension=php_mbstring.dll, extension=php_exif.dll 前的","去掉,然後重新啟動apache以上就是masterMIME偵測的PHP函式庫,需要的朋友可以直接下載使用。 #
<?php namespace Lurker\Tests; use Lurker\ResourceWatcher; use Lurker\Resource\TrackedResource; use Lurker\Event\FilesystemEvent; use Lurker\Resource\FileResource; use Lurker\Resource\DirectoryResource; class ResourceWatcherTest extends \PHPUnit_Framework_TestCase { private $tracker; private $dispatcher; protected function setUp() { $this->tracker = $this ->getMockBuilder('Lurker\Tracker\TrackerInterface') ->getMock(); $this->dispatcher = $this ->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface') ->getMock(); }每個檔案或資料夾都貼有一個RFID資源標籤,這個標籤包含獨一無二的ID和可讀資訊。當文件被放入具有RFID功能的借出/歸還托盤中時,表示資料夾的獨一無二的ID就會被採集到並被發送至資料庫,同時文件清單在任何時候都會被保留。 RFID手持終端可協助使用者快速找到特定檔案並且在需要時進行庫存盤點。在尋找過程中,一旦在特定位置的檔案被定位,就會觸發可視化視覺警報。另一方面,有了具備WiFi 功能的行動裝置,所有採集到的庫存盤點資料都被同步發送至文件追蹤系統的中央資料庫用於驗證目的。這就是資源追蹤庫。 #