开发者

What is the best way to get a configuration variable in PHP

开发者 https://www.devze.com 2023-01-20 01:03 出处:网络
Each server (Dev, QA, Prod) has a different IP address and URL. I would like to 开发者_开发问答write code so that it can pull that information (the URL for the particular server I am running the code

Each server (Dev, QA, Prod) has a different IP address and URL. I would like to 开发者_开发问答write code so that it can pull that information (the URL for the particular server I am running the code on) from a configuration file and store it in a variable.

Preferably I would like to avoid having to read the information from a file on subsequent requests since the information should not be changing often.

What is the best way to accomplish this?


Use the $_SERVER array to get the current server details

http://php.net/manual/en/reserved.variables.server.php

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号