drupal8变量的存储和设定使用yml文件 variable_get()/variable_set()替换为get()/set() <?php // Load a set of configuration out of the active store. // 'node.settings' refers to the filename of the .yml file, without the extension. //导入 $config = config('node.settings'); // Access a single value out of the store. echo $config->get('items_per_page'); // Change a value and save it back to both the active store and the filesystem. //--改变和保存 $config->set('items_per_page','20'); $config->save(); ?> config 文件存储目录 config/node.settings.yml 文件存储内容 <?php items_per_page: '10' ?>