Use Heroku config vars with PHP?

前端 未结 1 1267
你的背包
你的背包 2020-12-11 01:43

I\'ve been able to find information on how to use config vars in Heroku for Python, node.js, and some other languages, but not for PHP. Can you use them with PHP, or is it n

相关标签:
1条回答
  • 2020-12-11 02:07

    Config vars on heroku manifest themselves as environment variables, so you should be able to access them from php like you would any other environment variable, eg. using getenv.

    First, set the variable from your console:

    heroku config:set MY_VAR=somevalue
    

    Then, access it from your code:

    $my_env_var = getenv('MY_VAR');
    
    0 讨论(0)
提交回复
热议问题