2
MSXML2.XMLHTTP.3.0對象如何連接到同一個會話?我想我自己的ActiveX控件展現出這種行爲。如何在我的ActiveX控件中使用Internet Explorer的Cookies?
的index.php:(服務器端語言是不相關的):
<?php session_start(); session_write_close(); ?>
<html>
<head>
<title>Disp Test</title>
<script type="text/javascript">
window.onload = function()
{
var divJS;
var objXHR;
divJS = document.getElementById('js');
objXHR = new ActiveXObject("MSXML2.XMLHTTP.3.0");
objXHR.open("GET", "ajax.php", false);
objXHR.send();
divJS.innerHTML = objXHR.responseText;
}
</script>
</head>
<body>
<p>Your session ID: <?php echo session_id(); ?></p>
<div id="js">
Please enable Javascript.
</div>
</body>
</html>
ajax.php:
<?php session_start(); session_write_close();?>
Your session ID from AJAX: <?php echo session_id(); ?>
結果:
Your session ID: d2ljvbjllsdlc51rsq5naiffc2
Your session ID from AJAX: d2ljvbjllsdlc51rsq5naiffc2