繁体   English   中英

将应用程序配置变量存储到数据库

[英]Store application config variables to database

是否有任何PHP开源类可以在MySQL数据库中存储应用程序配置变量,例如Wordpress? 我想存储和读取如下内容:

$config['name'] = "test1";
$config['name']['subname'] = "test2";

在MySQL数据库表中,并且数据库表需要看起来像这样

Id | Name      | Value   | Parent Name Id |
1  | 'name'    | 'test1' | null           |
2  | 'subname' | 'test2' | 1              |

等等

那不需要类的样式。 例如:

//config.php

    $config['name'] = "test1";
    $config['name']['subname'] = "test2";

//other php.

    require_once('{path to config.php}');
    echo $config['name'];
    echo $config['name']['subname'];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM