Saya tahu bahwa komentar dalam dokumen mengatakan bahwa
Melihat kode sumber untuk fungsi
Sejauh yang saya tahu, satu-satunya waktu ketika ia akan berperilaku case-insensitive adalah pada Windows karena itulah bagaimana variabel lingkungan Windows berperilaku API. Jika Anda menggunakan Linux, BSD, Mac, dll maka Seperti yang disebutkan oleh
mario , Jadi, untuk kode PHP yang paling portabel:
(PHP 4, PHP 5, PHP 7, PHP 8) getenv — Gets the value of an environment variable Descriptiongetenv(string getenv(): array You can see a list of all the environmental variables by using phpinfo(). Many of these variables are listed within » RFC 3875, specifically section 4.1, "Request Meta-Variables". Parametersvarname The variable name. local_only Set to true to only return local environment variables (set by the operating system or putenv). Return Values Returns the value of the environment variable Changelog
ExamplesExample #1 getenv() Example
NotesWarning If PHP is running in a SAPI such as Fast CGI, this function will always return the value of an environment variable set by the SAPI, even if
putenv() has been used to set a local environment variable of the same name. Use the See Also
Anonymous ¶ 4 years ago
jcastromail at yahoo dot es ¶ 1 year ago
eng.mrkto.com ¶ 12 years ago
php at keith tyler dot com ¶ 10 years ago
yw()beeznest!com ¶ 6 years ago
kyong ¶ 18 years ago
pritisn at gmail dot com ¶ 7 years ago
hello at jabran dot me ¶ 7 years ago
sam at sambarrow dot com ¶ 14 years ago
Anonymous ¶ 3 years ago
chuck dot reeves at gmail dot com ¶ 12 years ago
jaraco at jaraco dot com ¶ 5 years ago
= getenv('REMOTE_ADDR', true) ?: getenv('REMOTE_ADDR')?> f dot hartmann2 at gmx dot net ¶ 13 years ago
|