在Symfony2.0中,我想在使用app.php(prod env)时在router.yml中禁用一些url?

When using app_dev.php, there are some useful url for me to debug project. Such as

check_debug:
    pattern: /check_url1
    defaults: {....}

check_debug_and_prod:
    pattern: /check_url2
    defaults: {....}

check_prod:
    pattern: /check_url3
    defaults: {....}

I want to disable 'check_debug' when I using app.php(prod env), and disable 'check_prod' when I using app_dev.php(dev env), and keep 'check_debug_and_prod' both when using app.php or app_dev.php.

How to config in SF2?

You can have multiple routing.yml files for different environments. E. g. app/config/routing.yml, app/config/routing_dev.yml

You can have different routing files for different environments:

  1. Create src/AAA/Bundle/CCBundle/Resource/config/routing.yml
  2. Create src/AAA/Bundle/CCBundle/Resource/config/routing_dev.yml
  3. Include src/AAA/Bundle/CCBundle/Resource/config/routing.yml in app/config/routing.yml
  4. Include src/AAA/Bundle/CCBundle/Resource/config/routing_dev.yml in app/config/routing_dev.yml

You can use the routing_dev.yml to add routes you only want in the dev mode. When you will use app.php it will only check for routing.yml and this way you will not have to be preoccupied by the unwanted routes.

You can also create your own routing files. See how Sf2 handles to import inside yml files.