什么可以访问“应用程序设置键值"? [英] What Can Access "App Settings Key Values"?

查看:52
本文介绍了什么可以访问“应用程序设置键值"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Microsoft Azure Web App服务中,在应用程序设置下,在应用程序设置选项中有键-值"对选项.如果开发人员在多个目录中都有PHP或Python文件,则这些目录和(或)文件中的哪一个可以访问这些键值对.

In an Microsoft Azure Web App Service under Application Settings, there are Key-Value pair options within the option App Settings. If a developer has PHP or Python files in multiple directories, which of these directories and (or) files would have access to these key-value pairs.

示例:

假设开发人员在应用设置中具有以下键值对设置:

Suppose the developer has the following key value pair settings in App Settings:

键: $ variableString |值:我的第一个示例字符串."

键: $ variableNumber |值: 1000

PHP文件:

site \ wwwroot \ index.php

site \ wwwroot \ folderone \ pageone.php

site \ wwwroot \ folderone \ pagetwo.php

site \ wwwroot \ foldertwo \ page.php

所有这些文件都可以访问这些变量,还是需要对这些键值对的保存位置进行引用(以及在何处?),就像在每个带有 include的PHP文件中一样?指向 App Settings 文件的指针(Azure不会显示该文件)?

Would all these files have access to these variables, or would these files need to have a reference (and where?) to where these key-value pairs would be saved like in each PHP file with an include pointer to the App Settings file (Azure doesn't show this becomes a file)?

谢谢.

推荐答案

它们将作为环境变量提供,因此与文件的位置无关.

They will be available as environment variables so it doesn't matter where the file is.

如果您使用键ITEM_COUNT和值15设置应用程序设置,则可以使用:

If you set an app setting with key ITEM_COUNT and value 15, you could use:

$item_count = getenv('ITEM_COUNT');

或者:

$item_count = getenv('APPSETTING_ITEM_COUNT');

$ item_count将包含字符串"15".

And $item_count would contain the string "15".

这篇关于什么可以访问“应用程序设置键值"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆