php bin/magento
下面的文章包含一个命令列表(magento help ),其中包含所有可能的用例和参数。像Admin这样的命令组没有任何扩展信息,因为这是没有意义的,因为命令本身会显示一些信息,并且没有要传递的参数。
vagrant@mage2:/vagrant/data/magento2/bin$ php magento
Magento CLI版本1.0.0-beta
Usage:
1 | command [options] [arguments] |
Options:
1 2 3 4 5 6 7 8 9 10 11 12 | --quiet (-q) Do not output any message --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debugging --version (-V) Display an application version --ansi Force ANSI output --no-ansi Disable ANSI output --no-interaction (-n) Do not ask any interactive question |
Available commands:
1 2 3 | help Displays help for a command list Lists commands |
admin
1 | admin:user:create Creates an administrator |
cache
1 2 3 4 5 6 7 8 9 | cache:clean Cleans cache type(s) cache:disable Disables cache type(s) cache:enable Enables cache type(s) cache:flush Flushes cache storage used by cache type(s) cache:status Checks cache status |
catalog
1 | catalog:images:resize Creates resized product images |
cron
1 | cron:run Runs jobs by schedule |
dev
1 2 3 4 5 | dev:css:deploy Collects, processes and publishes source LESS files dev:tests:run Runs tests dev:xml:convert Converts XML file using XSL style sheets |
i18n
1 2 3 4 5 | i18n:collect-phrases Discovers phrases in the codebase i18n:pack Saves language package i18n:uninstall Uninstalls language packages |
indexer
1 2 3 4 5 6 7 8 9 | indexer:info Shows allowed Indexers indexer:reindex Reindexes Data indexer:set-mode Sets index mode type indexer:show-mode Shows Index Mode indexer:status Shows status of Indexer |
info
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | info:adminuri Displays the Magento Admin URI info:backups:list Prints list of available backup files info:currency:list Displays the list of available currencies info:dependencies:show-framework Shows number of dependencies on Magento framework info:dependencies:show-Magento 2 modules Shows number of dependencies between Magento 2 modules info:dependencies:show-Magento 2 modules-circular Shows number of circular dependencies between Magento 2 modules info:language:list Displays the list of available language locales info:timezone:list Displays the list of available timezones |
maintenance
1 2 3 4 5 6 7 | maintenance:allow-ips Sets maintenance mode exempt IPs maintenance:disable Disables maintenance mode maintenance:enable Enables maintenance mode maintenance:status Displays maintenance mode status |
module
1 2 3 4 5 6 7 | module:disable Disables specified Magento 2 modules module:enable Enables specified Magento 2 modules module:status Displays status of Magento 2 modules module:uninstall Uninstalls Magento 2 modules installed by composer |
setup
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | setup:backup Takes backup of Magento Application code base, media and database setup:config:set Creates or modifies the deployment configuration setup:cron:run Runs cron job scheduled for setup application setup:db-data:upgrade Installs and upgrades data in the DB setup:db-schema:upgrade Installs and upgrades the DB schema setup:db:status Checks if DB schema or data requires upgrade setup:di:compile Generates DI configuration and all non-existing interceptors and factories setup:di:compile-multi-tenant Generates all non-existing proxies and factories, and pre-compile class definitions, inheritance information and plugin definitions setup:install Installs the Magento application setup:performance:generate-fixtures Generates fixtures setup:rollback Rolls back Magento Application codebase, media and database setup:store-config:set Installs the store configuration setup:uninstall Uninstalls the Magento application setup:upgrade Upgrades the Magento application, DB data, and schema |
theme
1 | theme:uninstall Uninstalls theme |
管理 admin Magento 2 CLI命令
admin:user:create
创建Magento管理员用户帐户
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | Usage: admin:user:create [--admin-user="..."] [--admin-password="..."] [--admin-email="..."] [--admin-firstname="..."] [--admin-lastname="..."] [--magento-init-params="..."] Options: --admin-user (Required) Admin user --admin-password (Required) Admin password --admin-email (Required) Admin email --admin-firstname (Required) Admin first name --admin-lastname (Required) Admin last name --magento-init-params Add to any command to customize Magento initialization parameters For example: "MAGE_MODE=developer&MAGE_DIRS[base][path]=/var/www/example.com&MAGE_DIRS[cache][path]=/var/tmp/cache" --help (-h) Display this help message --quiet (-q) Do not output any message --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug --version (-V) Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output --no-interaction (-n) Do not ask any interactive question |
缓存Magento 2 CLI命令
cache:status
通过这个命令,您可以看到所有Magento 2缓存的列表,其中每个缓存都可以用于诸如clean或disable之类的缓存管理命令。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | Current status: config: 1 layout: 1 block_html: 1 view_files_fallback: 1 viewfiles_preprocessing: 1 collections: 1 db_ddl: 1 eav: 1 full_page: 1 translate: 1 config_integration: 1 config_integration_api: 1 config_webservice: 1 |
cache:clean
按类型或全部缓存完成清除Magento 2缓存。
1 2 3 4 5 6 7 8 9 10 11 12 13 | Usage: cache:clean [--all] [--bootstrap="..."] [types1] ... [typesN] Arguments: types List of cache types, space separated. If omitted, all caches will be affected Options: --all All cache types --bootstrap add or override parameters of the bootstrap |
cache:disable
禁用Magento 2种特定缓存类型或全部缓存完成。
1 2 3 4 5 6 7 8 9 10 11 12 13 | Usage: cache:disable [--all] [--bootstrap="..."] [types1] ... [typesN] Arguments: types List of cache types, space separated. If omitted, all caches will be affected Options: --all All cache types --bootstrap add or override parameters of the bootstrap |
cache:flush
刷新Magento 2缓存存储
1 2 3 4 5 6 7 8 9 10 11 12 13 | Usage: cache:flush [--all] [--bootstrap="..."] [types1] ... [typesN] Arguments: types List of cache types, space separated. If omitted, all caches will be affected Options: --all All cache types --bootstrap add or override parameters of the bootstrap |