安裝擴充套件
首先安裝thinkphp5的單元測試擴充套件,進入命令列,切換到應用根目錄下面後,執行:
composer require topthink/think-testing
如果沒安裝composer就會報錯。看下面:
===下面就有幾行是因為沒連上報的錯。
首先要安裝composer
php -r "readfile('');" | php
3.chmod +x composer
4.再進行下一步。
macdemacbook-pro:tp5 mac$
composer require topthink/think-testing
using version ^1.0 for topthink/think-testing
./composer.json has been updated
loading composer repositories with package information
updating dependencies (including require-dev)
failed to decode response: zlib_decode(): data error
retrying with degraded mode, check for more info
package operations: 27 installs, 0 updates, 0 removals
- installing topthink/think-installer (v1.0.11): downloading (100%)
- installing topthink/framework (v5.0.7): downloading (100%)
- installing symfony/polyfill-mbstring (v1.3.0): downloading (35%)
downloading (100%)
- installing symfony/dom-crawler (v2.8.18): downloading (100%)
- installing symfony/yaml (v3.2.5): downloading (100%)
- installing sebastian/version (1.0.6): downloading (100%)
- installing sebastian/global-state (1.1.1): downloading (failed)
downloading (100%)
- installing sebastian/recursion-context (1.0.5): downloading (100%)
- installing sebastian/exporter (1.2.2): downloading (failed)
downloading (100%)
- installing sebastian/environment (1.3.8): downloading (100%)
- installing sebastian/diff (1.4.1): downloading (100%)
- installing sebastian/comparator (1.2.4): downloading (100%)
- installing doctrine/instantiator (1.0.5): downloading (100%)
- installing phpunit/php-text-template (1.2.1): downloading (100%)
- installing phpunit/phpunit-mock-objects (2.3.8): downloading (95%)
downloading (100%)
- installing phpunit/php-timer (1.0.9): downloading (100%)
- installing phpunit/php-file-iterator (1.4.2): downloading (100%)
- installing phpunit/php-token-stream (1.4.11): downloading (100%)
- installing phpunit/php-code-coverage (2.2.4): downloading (100%)
- installing webmozart/assert (1.2.0): downloading (100%)
- installing phpdocumentor/reflection-common (1.0): downloading (100%)
- installing phpdocumentor/type-resolver (0.2.1): downloading (100%)
- installing phpdocumentor/reflection-docblock (3.1.1): downloading (100%)
- installing phpspec/prophecy (v1.7.0): downloading (100%)
- installing phpunit/phpunit (4.8.35): downloading (100%)
- installing topthink/think-helper (v1.0.5): downloading (100%)
- installing topthink/think-testing (v1.0.6): downloading (100%)
invalid zip file, retrying...
- installing topthink/think-testing (v1.0.6): downloading (100%)
symfony/dom-crawler suggests installing symfony/css-selector ()
symfony/yaml suggests installing symfony/console (for validating yaml files using the lint command)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.1)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
writing lock file
generating autoload files
macdemacbook-pro:tp5 mac$
ThinkPHP5 0 接觸學習
mvc不是設計模式,而是設計典範。composer 是 php5.3以上 的乙個依賴管理工具。它允許你宣告專案所依賴的 庫,它會在你的專案中為你安裝他們。開發環境介紹 php版本 5.4.0 pdo mbstring curl php extension 安裝好這個擴充套件,thinkphp5能正常...
thinkphp5 0目錄結構
5.0的部署建議是public目錄作為web目錄訪問內容,其它都是web目錄之外,當然,你必須要修改public index.php中的相關路徑。如果沒法做到這點,請記得設定目錄的訪問許可權或者新增目錄列表的保護檔案。router.php用於php自帶webserver支援,可用於快速測試 啟動命令...
ThinkPHP5 0開發規範
thinkphp5 遵循 psr 2 命名規範和 psr 4 自動載入規範,並且注意如下規範 目錄和檔案 目錄使用小寫 下劃線 類庫 函式檔案統一以 php 為字尾 類的檔名均以命名空間定義,並且命名空間的路徑和類庫檔案所在路徑一致 類檔案採用駝峰法命名 首字母大寫 其它檔案採用小寫 下劃線命名 類...