我目前在php中有一个使用http socket的网站。因此,出于安全考虑,我们决定更改并强制将网站设置为HTTPS,我们对其进行了更改。 httaccass添加:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
这会迫使网站加入https,一切似乎都很好,但后来我的问题是我们当前的页面进行文件上传和文件上传以及作为电子邮件发送不再有效。
文件上传页面代码:
$strHeader .= "From: My site <".$from.">\n";
$strHeader .= "To: $t\n"; //was $to for a batch send
$strHeader .= $cc;
$strHeader .= $bcc;
$strHeader .= "MIME-Version: 1.0\n";
$strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n";
$strHeader .= "Subject: $subject\n";
$strHeader .= "This is a multi-part message in MIME format.\n";
$strHeader .= "--".$strSid."\n";
$strHeader .= "Content-type: text/html; charset=utf-8\n";
$strHeader .= "Content-Transfer-Encoding: 7bit\n\n";
$strHeader .= $message."\n\n";
$strFilesName = $_FILES["fileAttach2"]["name"];
$strContent = chunk_split(base64_encode(file_get_contents($_FILES["fileAttach2"]["tmp_name"])));
$strHeader .= "--".$strSid."\n";
$strHeader .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n";
$strHeader .= "Content-Transfer-Encoding: base64\n";
$strHeader .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n";
$strHeader .= $strContent."\n\n";
这适用于http,但我应该怎么做才能在https中启用它?然后还将文件正常上传到目录和一些生成pdf文件的脚本?