我是XMLHttpRequest的新手.我不明白为什么我们在send()函数之前编写onload()函数.onload()函数处理我们收到的响应和send()函数向服务器发送请求.所以onload()必须按照我的理解在send()函数之后编写.有人可以帮助理解这一点.
var xmlhttp = new XMLHttpRequest(),
method = 'GET',
url = 'https://developer.mozilla.org/';
xmlhttp.open(method, url, true);
xmlhttp.onload = function () {
// Do something with the retrieved data
};
xmlhttp.send();
Run Code Online (Sandbox Code Playgroud) 嗨,我正在尝试发送带有doc,docx和pdf附件的邮件.我收到了doc和docx的电子邮件.但是当我尝试用pdf附件发送邮件时,它无法正常工作.因此,我收到错误消息'上传的文件不支持文件类型'.我找不到错误.谁能帮我?我的代码:
<?php
$to = $_POST["txtTo"];
$subject = $_POST["txtSubject"];
$from = $_POST["txtFormEmail"];
$message = $_POST["txtDescription"];
$random_hash = md5(date('r', time()));
$headers .= "From: ".$from."<".$from.">\nReply-To: ".$_POST["txtFormEmail"]."";
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
$strFilesName = $_FILES["fileAttach"]["name"];
$attachment = chunk_split(base64_encode(file_get_contents($_FILES["fileAttach"]["tmp_name"])));
ob_start();
//Turn on output buffering
?> --PHP-mixed-<?php echo $random_hash; ?> Content-Type: multipart/alternative; boundary="PHP-alt-<?php echo $random_hash; ?>" --PHP-alt-<?php echo $random_hash; ?> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit --PHP-alt-<?php echo $random_hash; ?> Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 7bit <?php echo $message; ?> --PHP-alt-<?php echo $random_hash; ?>-- --PHP-mixed-<?php echo $random_hash; ?> …Run Code Online (Sandbox Code Playgroud) 是否可以在 Mozilla、chrome、IE 和 safari 等网络浏览器上使用本地 SQLite db。我的意思是,我可以将本地 SQLite db 用于 Web 应用程序吗?如果否,请建议替代本地数据库。