此函数将字符串转换为 base64 格式编码的字符串。这是一种常用的编码方案,通常用于需要作为文本在互联网上存储或传输的任何媒体,并使输出无法被人眼读懂。
base64_encode(string)
参数 | 类型 | 描述 |
---|---|---|
string | String | 要编码的字符串。 |
var str, file;
str = base64_encode(game_data);
file = file_text_open_write("save.txt");
file_text_write_string(file, str);
file_text_close(file);
上面的代码将把存储在“ game_ data”中的字符串转换为 base64 编码的字符串,然后将其存储在外部文本文件中。