官术网_书友最值得收藏!

The var directory

Magento does a lot of caching and autogeneration of certain class types. These caches and generated classes are all located in Magento's root var directory. The usual contents of the var directory is as follows:

cache
composer_home
generation
log
di
view_preprocessed
page_cache

During development, we will most likely need to periodically clear these so that our changes can kick in.

We can issue the console command as follows to clear individual directories:

rm -rf {Magento root dir}/var/generation/*

Alternatively, we can use the built-in bin/magento console tool to trigger commands that will delete the proper directories for us, as follows:

  • bin/magento setup:upgrade: This updates the Magento database schema and data. While doing this, it truncates the var/di and var/generation directories.
  • bin/magento setup:di:compile: This clears the var/generation directory. After doing this, it compiles the code in it again.
  • bin/magento deploy:mode:set {mode}: This changes the mode from the developer mode to the production mode and vice versa. While doing this, it truncates the var/di, var/generation, and var/view_preprocessed directories.
  • bin/magento cache:clean {type}: This cleans the var/cache and var/page_cache directories.

It is important to keep the var directory in mind at all times during development. Otherwise, the code might encounter exceptions and function improperly.

主站蜘蛛池模板: 丹棱县| 泰安市| 闽清县| 江陵县| 怀远县| 家居| 东安县| 高平市| 墨竹工卡县| 苏州市| 晋中市| 郴州市| 灌南县| 天水市| 郑州市| 门源| 延川县| 顺义区| 阜新| 扶风县| 丰台区| 盘锦市| 禹州市| 泽州县| 惠水县| 盐亭县| 大理市| 崇礼县| 台山市| 玉林市| 错那县| 呼伦贝尔市| 陆河县| 綦江县| 阳山县| 肥东县| 彰武县| 改则县| 天峨县| 长寿区| 平原县|