可以尝试以下方法解决此问题:
以下是一个示例代码:
try {
$decoded = base64_decode($data);
$result = file_put_contents('/path/to/file', $decoded);
if ($result === false) {
throw new Exception('Failed to write file.');
}
} catch (Exception $e) {
// Handle error...
}
$.ajax({
url: '/path/to/handler.php',
data: {
data: encodedData
},
timeout: 5000, // 5 seconds timeout
success: function(response) {
// Handle success...
},
error: function(xhr, status, error) {
// Handle error...
}
});
上一篇:ajax函数未找到