ini_close


描述

这个函数应该在完成对打开的 INI 文件的读取或写入时调用。如果在使用过任何 ini 写入函数之后不使用该函数,则不会将任何内容写入磁盘,因为文件信息保存在内存中,直到调用该函数,从而强制写入。If you try to open an ini without having previously closed another one (or the same one) you will get an error too.

函数还将返回含有 ini 文件编码的字符串。This string can then be saved to a server and/or used again along with the function ini_open_from_string to re-create the ini.


语法:

ini_close();


返回:

String(字符串)


例如:

ini_open("savedata.ini");
score = ini_read_real("save1", "score", 0);
ini_close();

这将打开 'savedata.ini' 并将得分设置为 “save1” 节(section)里的 “score” 键值,然后再次关闭 .ini。如果 “save1” 节 “score” 键没有值,或者没有 “savedata.ini” 文件,则得分将设置为 0 并创建新的 ini_file。