Apollo 配置变更原理_com.ctrip.framework.apollo net 监听-程序员宅基地

技术标签: spring  spring boot  java  Powered by 金山文档  Apollo  

我们经常用到apollo的两个特性:

1.动态更新配置:apollo可以动态更新@Value的值,也可以修改environment的值。

2.实时监听配置:实现apollo的监听器ConfigChangeListener,通过onChange方法来实时监听配置变化。

你知道apollo客户端是如何实现这些功能的吗?使用过程中,需要注意什么呢?

大致流程

在启动spring容器时,即会先后触发ApolloApplicationContextInitializer和ApolloConfigRegistrar为监听的namespace生成对应的config,并封装成propertySource放入env,后续更新就直接操作config,env的数据就被联动更新。

所以我们可以认为有两种方式(注解、配置)使用apollo,两者之间存在一些隐性关系(看到最后你会发现是坑哦)。

方式一:启动配置文件使用apollo——ApolloApplicationContextInitializer

com.ctrip.framework.apollo.spring.boot.ApolloApplicationContextInitializer#initialize(org.springframework.context.ConfigurableApplicationContext)

publicvoidinitialize(ConfigurableApplicationContext context){ConfigurableEnvironment environment = context.getEnvironment();

	//必须开启apollo.bootstrap.enabledString enabled = environment.getProperty(PropertySourcesConstants.APOLLO_BOOTSTRAP_ENABLED,"false");if(!Boolean.valueOf(enabled)){
      logger.debug("Apollo bootstrap config is not enabled for context {}, see property: ${
    {}}", context,PropertySourcesConstants.APOLLO_BOOTSTRAP_ENABLED);return;}
    logger.debug("Apollo bootstrap config is enabled for context {}", context);//!!!生成config,刷新器,将config塞入environment配置列表最前面(顺序决定优先级)initialize(environment);}protectedvoidinitialize(ConfigurableEnvironment environment){if(environment.getPropertySources().contains(PropertySourcesConstants.APOLLO_BOOTSTRAP_PROPERTY_SOURCE_NAME)){//already initializedreturn;}
	//从apollo.bootstrap.namespaces获取namespace,默认还是applicationString namespaces = environment.getProperty(PropertySourcesConstants.APOLLO_BOOTSTRAP_NAMESPACES,ConfigConsts.NAMESPACE_APPLICATION);
    logger.debug("Apollo bootstrap namespaces: {}", namespaces);List<String> namespaceList =NAMESPACE_SPLITTER.splitToList(namespaces);

	//生成名为ApolloBootstrapPropertySources的CompositePropertySource ,所有namespace共用该propertysource,namespace的顺序也是优先级顺序CompositePropertySource composite =newCompositePropertySource(PropertySourcesConstants.APOLLO_BOOTSTRAP_PROPERTY_SOURCE_NAME);for(String namespace : namespaceList){
    	//生成config(该部分公用,后续分析)Config config =ConfigService.getConfig(namespace);//封装为propertsource
     composite.addPropertySource(configPropertySourceFactory.getConfigPropertySource(namespace, config));}//最后添加到environment中,这里决定了优先级比注解高
    environment.getPropertySources().addFirst(composite);}
开启配置方式(apollo.bootstrap.enabled为true),则会触发ApolloAutoConfiguration 创建对应的处理器监听器,如动态修改@Value数据
@Configuration@ConditionalOnProperty(PropertySourcesConstants.APOLLO_BOOTSTRAP_ENABLED)@ConditionalOnMissingBean(PropertySourcesProcessor.class)publicclassApolloAutoConfiguration{@BeanpublicConfigPropertySourcesProcessorconfigPropertySourcesProcessor(){returnnewConfigPropertySourcesProcessor();}}publicclassConfigPropertySourcesProcessorextendsPropertySourcesProcessorimplementsBeanDefinitionRegistryPostProcessor{@OverridepublicvoidpostProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry)throwsBeansException{Map<String,Object> propertySourcesPlaceholderPropertyValues =newHashMap<>();// to make sure the default PropertySourcesPlaceholderConfigurer's priority is higher than PropertyPlaceholderConfigurer
    propertySourcesPlaceholderPropertyValues.put("order",0);BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry,PropertySourcesPlaceholderConfigurer.class.getName(),PropertySourcesPlaceholderConfigurer.class, propertySourcesPlaceholderPropertyValues);BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry,ApolloAnnotationProcessor.class.getName(),ApolloAnnotationProcessor.class);BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry,SpringValueProcessor.class.getName(),SpringValueProcessor.class);BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry,ApolloJsonValueProcessor.class.getName(),ApolloJsonValueProcessor.class);processSpringValueDefinition(registry);}/**
   * For Spring 3.x versions, the BeanDefinitionRegistryPostProcessor would not be
   * instantiated if it is added in postProcessBeanDefinitionRegistry phase, so we have to manually
   * call the postProcessBeanDefinitionRegistry method of SpringValueDefinitionProcessor here...
   */privatevoidprocessSpringValueDefinition(BeanDefinitionRegistry registry){SpringValueDefinitionProcessor springValueDefinitionProcessor =newSpringValueDefinitionProcessor();

    springValueDefinitionProcessor.postProcessBeanDefinitionRegistry(registry);}}

方式二:使用注解@EnableApolloConfig开启apollo

通过导入ApolloConfigRegistrar,触发PropertySourcesProcessor。

【创建application的beandefinition以后】

publicvoidregisterBeanDefinitions(AnnotationMetadata importingClassMetadata,BeanDefinitionRegistry registry){AnnotationAttributes attributes =AnnotationAttributes.fromMap(importingClassMetadata
        .getAnnotationAttributes(EnableApolloConfig.class.getName()));//从注解@EnableApolloConfig的value获取namespaceString[] namespaces = attributes.getStringArray("value");int order = attributes.getNumber("order");//在PropertySourcesProcessor添加namespace,order信息PropertySourcesProcessor.addNamespaces(Lists.newArrayList(namespaces), order);Map<String,Object> propertySourcesPlaceholderPropertyValues =newHashMap<>();// to make sure the default PropertySourcesPlaceholderConfigurer's priority is higher than PropertyPlaceholderConfigurer
    propertySourcesPlaceholderPropertyValues.put("order",0);BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry,PropertySourcesPlaceholderConfigurer.class.getName(),PropertySourcesPlaceholderConfigurer.class, propertySourcesPlaceholderPropertyValues);
	//创建PropertySourcesProcessor为namespace生成config等BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry,PropertySourcesProcessor.class.getName(),PropertySourcesProcessor.class);BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry,ApolloAnnotationProcessor.class.getName(),ApolloAnnotationProcessor.class);BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry,SpringValueProcessor.class.getName(),SpringValueProcessor.class);BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry,SpringValueDefinitionProcessor.class.getName(),SpringValueDefinitionProcessor.class);BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry,ApolloJsonValueProcessor.class.getName(),ApolloJsonValueProcessor.class);}

PropertySourcesProcessor初始化config(namespace排序),自动更新spring @Value的值

【在创建完所有beandefinition后触发】

publicvoidpostProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)throwsBeansException{
	//1.初始化config,刷新器,关联environmentinitializePropertySources();//2.初始化AutoUpdateConfigChangeListener,自动更新spring @Value的值initializeAutoUpdatePropertiesFeature(beanFactory);}privatevoidinitializePropertySources(){if(environment.getPropertySources().contains(PropertySourcesConstants.APOLLO_PROPERTY_SOURCE_NAME)){//already initializedreturn;}//生成名为ApolloPropertySources的CompositePropertySource ,所有namespace共用该propertysourceCompositePropertySource composite =newCompositePropertySource(PropertySourcesConstants.APOLLO_PROPERTY_SOURCE_NAME);//排序ImmutableSortedSet<Integer> orders =ImmutableSortedSet.copyOf(NAMESPACE_NAMES.keySet());Iterator<Integer> iterator = orders.iterator();while(iterator.hasNext()){int order = iterator.next();//按照order为每个namespace创建config(公用部分,后续分析)for(String namespace :NAMESPACE_NAMES.get(order)){Config config =ConfigService.getConfig(namespace);
        composite.addPropertySource(configPropertySourceFactory.getConfigPropertySource(namespace, config));}}// clean upNAMESPACE_NAMES.clear();// 在environment的ApolloBootstrapPropertySources后面或者直接在第一个位置加上前面封装的compsite propertysource,保证注解优先级低于配置方式if(environment.getPropertySources().contains(PropertySourcesConstants.APOLLO_BOOTSTRAP_PROPERTY_SOURCE_NAME)){// ensure ApolloBootstrapPropertySources is still the firstensureBootstrapPropertyPrecedence(environment);

      environment.getPropertySources().addAfter(PropertySourcesConstants.APOLLO_BOOTSTRAP_PROPERTY_SOURCE_NAME, composite);}else{
      environment.getPropertySources().addFirst(composite);}}

创建Config的系列操作

触发创建RemoteConfigRepository(内部包含首次同步apollo,启动定时刷新器,长轮训刷新器)

创建RemoteConfigRepository

之前说的 ConfigService.getConfig(namespace) ,获取不到config,就会创建一个config,最终创建RemoteConfigRepository。看其构造方法,除了各种属性赋值后,还会调用三个方法,它们很关键哈。

public RemoteConfigRepository(String namespace) {
  m_namespace = namespace;
  m_configCache = new AtomicReference<>();
  m_configUtil = ApolloInjector.getInstance(ConfigUtil.class);
  m_httpUtil = ApolloInjector.getInstance(HttpUtil.class);
  m_serviceLocator = ApolloInjector.getInstance(ConfigServiceLocator.class);
  remoteConfigLongPollService = ApolloInjector.getInstance(RemoteConfigLongPollService.class);
  m_longPollServiceDto = new AtomicReference<>();
  m_remoteMessages = new AtomicReference<>();
  m_loadConfigRateLimiter = RateLimiter.create(m_configUtil.getLoadConfigQPS());
  m_configNeedForceRefresh = new AtomicBoolean(true);
  m_loadConfigFailSchedulePolicy = new ExponentialSchedulePolicy(m_configUtil.getOnErrorRetryInterval(),
      m_configUtil.getOnErrorRetryInterval() * 8);
  gson = new Gson();
  // 首次同步apollo
  this.trySync();
  // 定时刷新配置(大部分情况返回304,定时刷新在于可以防止长轮询失败)
  this.schedulePeriodicRefresh();
  // 长轮询刷新配置(最主要的实时获取配置的途径)
  this.scheduleLongPollingRefresh();
}

首次同步apollo

@Override
protected synchronized void sync() {
  Transaction transaction = Tracer.newTransaction("Apollo.ConfigService", "syncRemoteConfig");

  try {
    ApolloConfig previous = m_configCache.get();
    // 根据你设定的apollo地址,appId,maxRetries等信息,发送get请求,获取当前apollo配置信息
    ApolloConfig current = loadApolloConfig();

    // 更新本地的apollo配置信息
    if (previous != current) {
      logger.debug("Remote Config refreshed!");
      m_configCache.set(current);
      // 刷新配置的任务可能会调用该方法,获取配置,并且通知客户端的监听器
      this.fireRepositoryChange(m_namespace, this.getConfig());
    }

    if (current != null) {
      Tracer.logEvent(String.format("Apollo.Client.Configs.%s", current.getNamespaceName()),
          current.getReleaseKey());
    }

    transaction.setStatus(Transaction.SUCCESS);
  } catch (Throwable ex) {
    transaction.setStatus(ex);
    throw ex;
  } finally {
    transaction.complete();
  }
}

开启定时刷新配置

private void schedulePeriodicRefresh() {
  logger.debug("Schedule periodic refresh with interval: {} {}",
      m_configUtil.getRefreshInterval(), m_configUtil.getRefreshIntervalTimeUnit());
  m_executorService.scheduleAtFixedRate(
      new Runnable() {
        @Override
        public void run() {
          Tracer.logEvent("Apollo.ConfigService", String.format("periodicRefresh: %s", m_namespace));
          logger.debug("refresh config for namespace: {}", m_namespace);
          // 和上述首次同步的trySync是同一个方法
          trySync();
          Tracer.logEvent("Apollo.Client.Version", Apollo.VERSION);
        }
          //时间间隔默认是5分钟
      }, m_configUtil.getRefreshInterval(), m_configUtil.getRefreshInterval(),
      m_configUtil.getRefreshIntervalTimeUnit());
}

开启长轮询刷新配置

public boolean submit(String namespace, RemoteConfigRepository remoteConfigRepository) {
  boolean added = m_longPollNamespaces.put(namespace, remoteConfigRepository);
  m_notifications.putIfAbsent(namespace, INIT_NOTIFICATION_ID);
  if (!m_longPollStarted.get()) {
    // 开启拉取  
    startLongPolling();
  }
  return added;
}

private void doLongPollingRefresh(String appId, String cluster, String dataCenter) {
  final Random random = new Random();
  ServiceDTO lastServiceDto = null;
  while (!m_longPollingStopped.get() && !Thread.currentThread().isInterrupted()) {
    if (!m_longPollRateLimiter.tryAcquire(5, TimeUnit.SECONDS)) {
      // 等待5秒
      try {
        TimeUnit.SECONDS.sleep(5);
      } catch (InterruptedException e) {
      }
    }
      
      // 获取各种信息,发起请求,看apollo中配置有无变更
      ......
          
      //200说明 配置发生变化,则主动获取新配置,且调用ConfigChangeListener的实现类的onChange方法    
      if (response.getStatusCode() == 200 && response.getBody() != null) {
        updateNotifications(response.getBody());
        updateRemoteNotifications(response.getBody());
        transaction.addData("Result", response.getBody().toString());
        notify(lastServiceDto, response.getBody());
      }
       
    //需要重新长链接
    //长链接可以监听服务端动态,不需要频繁与服务器建连访问,可以降低资源消耗,也可以得到及时变更通知
    if (response.getStatusCode() == 304 && random.nextBoolean()) {
      lastServiceDto = null;
    }

       ......
    } finally {
      transaction.complete();
    }
  }
}

notify方法会最终进入fireRepositoryChange

sync->fireRepositoryChange

该方法是之前介绍的sync()方法里面提到的,两类刷新配置的任务都会执行此方法,来通知各个监听器,有哪些配置变更。

1.获取新配置

2.统计各种配置的变更

3.通知各个监听器

protected void fireRepositoryChange(String namespace, Properties newProperties) {
  // 遍历所有的监听器
  for (RepositoryChangeListener listener : m_listeners) {
    try {
      // 把最新的配置信息传递给监听器
      listener.onRepositoryChange(namespace, newProperties);
    } catch (Throwable ex) {
      Tracer.logError(ex);
      logger.error("Failed to invoke repository change listener {}", listener.getClass(), ex);
    }
  }
}

@Override
public synchronized void onRepositoryChange(String namespace, Properties newProperties) {
  if (newProperties.equals(m_configProperties.get())) {
    return;
  }

  ConfigSourceType sourceType = m_configRepository.getSourceType();
  Properties newConfigProperties = new Properties();
  newConfigProperties.putAll(newProperties);

  // 整理且更新配置信息,确定配置的变更类型
  Map<String, ConfigChange> actualChanges = updateAndCalcConfigChanges(newConfigProperties, sourceType);

  //check double checked result
  if (actualChanges.isEmpty()) {
    return;
  }

  // 调用各个ConfigChangeListener实现类的onChange方法,发送配置信息
  this.fireConfigChange(new ConfigChangeEvent(m_namespace, actualChanges));

  Tracer.logEvent("Apollo.Client.ConfigChanges", m_namespace);
}

private Map<String, ConfigChange> updateAndCalcConfigChanges(Properties newConfigProperties,
    ConfigSourceType sourceType) {
  // 初次统计变化的配置  
  List<ConfigChange> configChanges =
      calcPropertyChanges(m_namespace, m_configProperties.get(), newConfigProperties);

  ImmutableMap.Builder<String, ConfigChange> actualChanges =
      new ImmutableMap.Builder<>();

  /** === Double check since DefaultConfig has multiple config sources ==== **/

  //1. 为配置设置旧值
  for (ConfigChange change : configChanges) {
    change.setOldValue(this.getProperty(change.getPropertyName(), change.getOldValue()));
  }

  //2. 更新 m_configProperties,该处本地env配置被更新
  updateConfig(newConfigProperties, sourceType);
  clearConfigCache();

  //3. 遍历所有的新配置,最后确认各个配置的type(ADDED/MODIFIED/DELETED)
  for (ConfigChange change : configChanges) {
    change.setNewValue(this.getProperty(change.getPropertyName(), change.getNewValue()));
    switch (change.getChangeType()) {
      case ADDED:
        if (Objects.equals(change.getOldValue(), change.getNewValue())) {
          break;
        }
        if (change.getOldValue() != null) {
          change.setChangeType(PropertyChangeType.MODIFIED);
        }
        actualChanges.put(change.getPropertyName(), change);
        break;
      case MODIFIED:
        if (!Objects.equals(change.getOldValue(), change.getNewValue())) {
          actualChanges.put(change.getPropertyName(), change);
        }
        break;
      case DELETED:
        if (Objects.equals(change.getOldValue(), change.getNewValue())) {
          break;
        }
        if (change.getNewValue() != null) {
          change.setChangeType(PropertyChangeType.MODIFIED);
        }
        actualChanges.put(change.getPropertyName(), change);
        break;
      default:
        //do nothing
        break;
    }
  }
  return actualChanges.build();
}

总结两种方式的异同

相同之处

1.创建config的流程和最终关联environment的方式。

2.默认情况下,都是使用application namespace。

不同之处

1.注解模式优先级低于配置方式。

2. 注解可以在多个地方使用,可以批量设置注解的namespace的优先级;配置文件只能按照配置的顺序来决定优先级。

可能存在的坑

1.如果配置方式和注解方式同时使用,则优先从配置方式里面的namespace读取配置,没有则会从注解的namespace读取配置,不要误以为只会用配置文件指定的namespace!!!

2.如果只是监听application 这个namespace,可以使用ConfigService.getAppConfig(),如果是监听其他XXX namespace,一定要用ConfigService.getAppConfig(“XXX”),不然,就会因为你是用的api触发监听application!!!也就是,即便你只用了配置方式,明确了使用XXXnamespace,还是会以application作为兜底!!!

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_19734597/article/details/129665872

智能推荐

Python 加密解密_咕咕加密v4-程序员宅基地

文章浏览阅读1k次。# -*- coding: utf-8 -*-import hashlib'''加密解密'''#MD5是最常见的摘要算法,速度很快,生成结果是固定的128 bit字节,# 通常用一个32位的16进制字符串表示。md5 = hashlib.md5()update = md5.update('hhhhhaaa')print(md5.hexdigest())#SHA1的结果是160..._咕咕加密v4

使用cesium primitive api绘制三维插值图,热力图_cesium 插值点-程序员宅基地

文章浏览阅读1.4k次,点赞3次,收藏13次。【代码】使用cesium primitive api绘制三维插值图。_cesium 插值点

flask + pyecharts 疫情数据分析 搭建交互式动态可视化疫情趋势分析、舆情监测平台(附代码实现)_疫情舆情分析代码-程序员宅基地

文章浏览阅读978次,点赞3次,收藏21次。该项目是浙江大学地理空间数据库课程作业8:空间分析中,使用 flask + pyecharts搭建的简单新冠肺炎疫情数据可视化交互分析平台的一部分,完整的实现包含疫情数据获取、态势感知、预测分析、舆情监测等任务;包含完整代码、数据集和实现的github地址: https://github.com/yunwei37/COVID-19-NLP-vis项目分析报告已部署到网页端,可点击 http://flask.yunwei123.tech/ 进行查看,数据已更新到6.17本项目采用flask作为_疫情舆情分析代码

python之09-tuple元组-程序员宅基地

文章浏览阅读254次。详细请参考:https://www.cnblogs.com/Neeo/articles/11212374.html1、元组的基本操作1>创建元组Python中,元组(tuple)用一对小括号()表示,元组内的各元素以逗号分隔。t = ()print(type(t)) # <type 'tuple'>t1 = ('name', )print(t1) ..._tuple元祖for循环取值

c语言程序怎样生产dll文件,关于c语言创建dll文件及dll文件的调用-程序员宅基地

文章浏览阅读860次。关于c语言创建dll文件及dll文件的调用近来又有人在群里问如何用c语言编制dll文件(动态链接库)。原来没有对这个问题太在意过,也没有尝试过任何解决方案,毕竟原来我是用vb的(现在用.net),做个dll只不过是点选一下建立activeX dll工程的图标而已。今天在网上与朋友聊天,看了他指给我的几个几个文件,用MingW将C程序编译成dll文件的例子,我恍然大悟,原来讲C程序编译成dll文件只..._keil c语言 生成dll

【学习笔记】基于遗传算法的BP神经网络优化算法_遗传算法优化 bp 染色体-程序员宅基地

文章浏览阅读6.8k次,点赞11次,收藏111次。一、背景介绍BP神经网络是一类多层的前馈神经网络。它的名字源于在网络训练的过程中,调整网络的权值的算法是误差的反向传播的学习算法,即为BP学习算法。BP神经网络是人工神经网络中应用广泛的算法,但依然存在着一些缺陷,例如学习收敛速度太慢、不能保证收敛到全局最小点、网络结构不易确定等。另外,网络结构、初始连接权值和阈值的选择对网络训练的影响很大,但是又无法准确获得,针对这些特点可以采用遗传算法对神经网络进行优化。二、算法流程创建网络;确定网络的初始权重值和阈值,对其进行编码得到初始种群;while_遗传算法优化 bp 染色体

随便推点

二、Json对象、Json数组和Json字符串_json字符串数组-程序员宅基地

文章浏览阅读6.7k次,点赞3次,收藏17次。一、Json字符串和Json对象定义:1、Json字符串:所谓字符串:单引号或者双引号引起来,是一个String类型的字符串:如下:var person='{"name":"shily","sex":"女","age":"23"}';//json字符串console.log(person)console.log(person.name)console.log(typeof person) 2、Json对象:最显著的特征:对象的值可以用 “对象.属性” 进行访问,_json字符串数组

Linux系统100条命令:关于Ubuntu和 CentOS 7 相同功能的不同的终端操作命令_ubuntu 命令跟centos-程序员宅基地

文章浏览阅读718次。CentOS 7:ip link set interface_name up 或 ip link set interface_name down。Ubuntu:ifconfig interface_name up 或 ifconfig interface_name down。CentOS 7:编辑 /etc/sysconfig/network-scripts/ifcfg-eth0 文件。Ubuntu:编辑 /etc/network/interfaces 文件。_ubuntu 命令跟centos

windows10下VS2019编译jpegsrc.v9e.tar.gz为lib静态库(已验证)_jpeg library error vs2019-程序员宅基地

文章浏览阅读652次。jpegsr9e windows vs2019生成方法,以及库下载_jpeg library error vs2019

重磅?华为 Mate60/Pro 系列网速实测结果公布,最高 1205.57 Mbps_华为mate60pro+核实网络-程序员宅基地

文章浏览阅读647次。总的来说,华为Mate 60/Pro系列手机的高速网速表现引起了广泛的关注,这也是消费者对该系列手机购买热情高涨的一个重要因素。可以看出,华为Mate 60/Pro系列手机的网速表现非常出色,这也是消费者购买该系列手机的一个重要原因。此前,华为Mate 60 Pro的供应量已经增至1500万至1700万台,而最新消息称,华为Mate 60 Pro和Mate 60 Pro+的出货量甚至已上调至2000万台。目前,在中国市场上,手机竞争愈发激烈,不仅华为Mate 60系列,其他品牌的手机也都受到了高温的迎接。_华为mate60pro+核实网络

access查找出生日期年份_access怎样利用出生日期计算年龄呀!-程序员宅基地

文章浏览阅读7.1k次。公告: 为响应国家净网行动,部分内容已经删除,感谢读者理解。话题:access怎样利用出生日期计算年龄呀!回答:lt;%set rs = server.createobject("adodb.recordset") curid=request("id") sql = "UPDATE pany SET a_num=a_num+1,day_count=day_count+1 WHERE day_lda..._access出生年份表达式

python 内置函数-程序员宅基地

文章浏览阅读75次。Python内置函数(1)——absPython内置函数(2)——divmodPython内置函数(3)——maxPython内置函数(4)——minPython内置函数(5)——powPython内置函数(6)——roundPython内置函数(7)——sumPython内置函数(8)——bool...