drupal8变量的存储和设定使用yml文件

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'
?>

 

posted on 2016-04-28 15:27  岩_生  阅读(265)  评论(0编辑  收藏  举报

导航