在本教程中,我们将讨论安装/卸载样本数据通过命令行中的命令行系列。如您所知,在Magento 2中,它们在中添加了许多命令bin/magento
。这可能很难解决,让我解释一下它的更多细节。
通过命令行安装/卸载示例数据
转到Magento管理员根文件夹并显示用法:
php bin/magento maintenance:enable
结果:
Usage:
sampledata:deploy [options]
Options:
--no-update Update composer.json without executing composer update
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Deploy sample data modules
安装样本数据语法
php bin/magento sampledata:deploy [options]
默认情况下,它将通过composer更新示例数据的最新版本,然后进行安装。您可以使用参数禁用它:--no-update
php bin/magento sampledata:deploy --no-update
Magento要求我输入用户名和密码,如下所示:
不用担心,请访问“访问密钥”页面,然后Create A New Access Key
卸载示例数据语法
转到Magento管理员根文件夹并显示用法:
php bin/magento sampledata:remove -h
输出:
Usage:
sampledata:remove [options]
Options:
--no-update Update composer.json without executing composer update
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Remove all sample data packages from composer.json
句法:
php bin/magento sampledata:remove [options]