D语言新手问题 D语言是否校验配置参数

· Created · Last modified by yunfeng~ replied at · 123 times read

1.config对应文件中新建配置参数

account.isVerification = 0

2.引用配置参数进行判断

import hunt.framework.application.ApplicationConfig;
auto conf = configManager().config("hunt");
auto isUseConf = conf.account.isVerification.value.to!short;
if(isUseConf == 0)
{...}
else
{...}

这个是 Hunt Framework 的自定义配置项

Login to reply