如何使用Phonegap將html寫入文本文件?我正在嘗試遵循API文檔中的示例。文件創建工作,但我不能讓console.log工作。如何使用Phonegap將console.log()html
function gotFS(fileSystem) {
fileSystem.root.getFile("readme.txt", {create: true, exclusive: false}, gotFileEntry, fail);
}
function gotFileEntry(fileEntry) {
fileEntry.createWriter(gotFileWriter, fail);
}
function gotFileWriter(writer) {
writer.onwriteend = function(evt) {
console.log($("h1"));
};
}
function fail(error) {
console.log(error.code);
}
<body>
<h1>Example</h1>
<p>Write File</p>
</body>
'的console.log()'不會寫入一個文本文件,它只能輸出到JavaScript控制檯信息。 – MBillau
我應該一直使用WRITER.WRITE()而不是console.log() – Yerpasaur