概述 快速入门 教程 手册 最佳实践 组件 参考 贡献

发布于 2015-08-27 16:40:54 | 155 次阅读 | 评论: 0 | 来源: 网络整理

The Using Console Commands, Shortcuts and Built-in Commands page of the components documentation looks at the global console options. When you use the console as part of the full stack framework, some additional global options are available as well.

By default, console commands run in the dev environment and you may want to change this for some commands. For example, you may want to run some commands in the prod environment for performance reasons. Also, the result of some commands will be different depending on the environment. For example, the cache:clear command will clear and warm the cache for the specified environment only. To clear and warm the prod cache you need to run:

$ php app/console cache:clear --env=prod

or the equivalent:

$ php app/console cache:clear -e prod

In addition to changing the environment, you can also choose to disable debug mode. This can be useful where you want to run commands in the dev environment but avoid the performance hit of collecting debug data:

$ php app/console list --no-debug

There is an interactive shell which allows you to enter commands without having to specify php app/console each time, which is useful if you need to run several commands. To enter the shell run:

$ php app/console --shell
$ php app/console -s

You can now just run commands with the command name:

Symfony > list

When using the shell you can choose to run each command in a separate process:

$ php app/console --shell --process-isolation
$ php app/console -s --process-isolation

When you do this, the output will not be colorized and interactivity is not supported so you will need to pass all command params explicitly.

注解

Unless you are using isolated processes, clearing the cache in the shell will not have an effect on subsequent commands you run. This is because the original cached files are still being used.

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务