C# 字符串的存储和读取

1.存储字符串到指定路径文件中:
//第1个参数 :存储的路径
//第2个参数 :存储的字符串内容
File.WriteAllText(Application.persistentDataPath+"/Test.json","哈哈哈哈哈哈哈哈");
print(Application.persistentDataPath);

2.在指定路径文件中读取字符串
//参数:读取的路径
string str = File.ReadAllText(Application.persistentDataPath + "/Test.json");
print(str);

posted @ 2021-11-05 00:07  赛涛科技  阅读(992)  评论(0)    收藏  举报