您好,登錄后才能下訂單哦!
本篇文章給大家分享的是有關(guān)如何自動加載一個文件后必須執(zhí)行命令composer dump-autoload,小編覺得挺實用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。
一、自動加載一個文件后必須執(zhí)行命令
{ "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": [ "framework", "laravel" ], "license": "MIT", "require": { "laravel/framework": "4.2.*", "pda/pheanstalk": "~2.0", "doctrine/dbal": "2.4.*", "guzzlehttp/guzzle": "5.3.1", "firebase/php-jwt": "4.0", "twilio/sdk": "5.7", "ircmaxell/random-lib": "1.2", "mjaschen/phpgeo": "1.3", "dompdf/dompdf": "0.8.2", "league/csv": "9.2" }, "autoload": {#自動加載,方式分為files(files鍵對應(yīng)的值是一個數(shù)組,數(shù)組元素是文件的路徑,路徑是相對于應(yīng)用的根目錄)和classmap(通過文件引入的方法雖然直觀,但是很費勁,每個文件都得引入一次,實在不是好的解決辦法,可以采用classmap,即兼容files,又可目錄自動加載) "classmap": [ "app/commands", "app/controllers", "app/models", "app/database/migrations", "app/database/seeds", "app/tests/TestCase.php", "app/libraries", "app/helpers", "app/logic", "app/jobs", "app/validators", "app/3rd", "app/classes", "app/filters" ] }, "scripts": { "post-install-cmd": [ "php artisan clear-compiled", "php artisan optimize" ], "post-update-cmd": [ "php artisan clear-compiled", "php artisan optimize" ], "post-create-project-cmd": [ "php artisan key:generate" ] }, "config": { "preferred-install": "dist" }, "minimum-stability": "stable", "require-dev": { "phpunit/phpunit": "4.8" }, "repositories": { "packagist": { "type": "composer", "url": "https://packagist.laravel-china.org" } } }
因為app\logic自動加載,每次文件改動理論上無需改動,但是會遇到ide代碼無法跳轉(zhuǎn)的問題,需執(zhí)行
composer dump-autoload
二、若ide還是無法跳轉(zhuǎn),可以嘗試
邏輯層工廠類,注釋@return項,添加所需邏輯層(ShopLogic),ide就能識別跳轉(zhuǎn)了
以上就是如何自動加載一個文件后必須執(zhí)行命令composer dump-autoload,小編相信有部分知識點可能是我們?nèi)粘9ぷ鲿姷交蛴玫降?。希望你能通過這篇文章學(xué)到更多知識。更多詳情敬請關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。