Magento 2 每次修改模板,安装新模块都要做刷新动作,为省事直接把需要的命令记录一下。
1、刷新/添加/更新 模块 模板
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento setup:static-content:deploy zh_Hans_CN it_IT -f
php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush
2、只刷新静态页面
php bin/magento setup:static-content:deploy -f
php bin/magento setup:static-content:deploy zh_Hans_CN it_IT -f
php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush
3、修复目录权限
sudo find . -type d -exec chmod 755 {} \;
sudo find . -type f -exec chmod 664 {} \;
sudo find . -type f -name "*.sh" -exec chmod 774 {} \;
sudo find var generated vendor pub/static pub/media app/etc var/page_cache -type f -exec chmod g+w {} + && sudo find var generated vendor pub/static pub/media app/etc var/page_cache -type d -exec chmod g+ws {} + && sudo chown -R daemon:daemon . && sudo chmod u+x bin/magento && sudo chmod u+x bin/magento-cli