1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Config Help

Discussion in 'Development' started by azk_, Nov 21, 2017.

  1. azk_

    azk_ Spider Jockey

    Messages:
    49
    Hi guys, i have a simple question..
    How can i get and set "test" from config.yml
    I can only get "Name" I do not know how to get the value x: "test"

    $config = new Config($this->getDataFolder() . "/config.yml", Config::YAML);
    $name = $config->get("name");

    PHP:
    Name:
     
    xtest
     y
    aaaa
     z
    bbbb
    P.s: sorry for noob english
     
  2. MioTaku

    MioTaku Witch

    Messages:
    69
    GitHub:
    uselesswaifu
    I might be mistaken; but, I believe it is..
    PHP:
    $x $config->get("Name")["x"];
     
  3. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    PHP:
    // getter
    $x $config->getNested("Name.x""default");

    //setter
    $config->setNested("Name.x"$x);
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.