【问题标题】:Laravel 4 - Switching config values per environmentLaravel 4 - 每个环境切换配置值
【发布时间】:2014-09-27 13:34:54
【问题描述】:

我现在使用 Stripe 作为我的支付网关,

我要做的是根据环境切换按键

在我的 start.php 中,我有以下设置

'local' => array('mymacpro'),
'production' => array('r2d2.mydomain.com')

我可以在 stripe.php 配置文件中执行以下操作吗?

if environment = local then use this key
else use this key

任何帮助将不胜感激。

干杯,

【问题讨论】:

    标签: laravel laravel-4 stripe-payments


    【解决方案1】:

    只需按照这里的说明http://laravel.com/docs/configuration#environment-configuration 为两个环境做两个文件并将密钥放在那里。

    喜欢app/config/stripe.php 和app/config/local/stripe.php 会是哪些内容

    <?php
    return [
        'key' => 'KEY',
    ];
    

    然后在您的应用程序中执行Config::get('stripe.key'),它会自动切换。

    【讨论】:

      猜你喜欢
      • 2014-04-20
      • 2019-02-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-02
      • 2016-10-22
      • 1970-01-01
      • 2013-07-07
      • 1970-01-01
      相关资源
      最近更新 更多