PHP+AJAX ÐÂÊÖÌáÎÊ - PHP / Framework
ÎÒÏëѧϰһÏÂAJAX£¬°´×ÅÍøÉϵÄʵÀýÊÔÁËһϣ¬Ìá½»ºóûÓÐÈκη´Ó¦£¬Çë¸ßÊÖÖ¸½ÌÒÔÏ£¬´úÂëÈçÏ£¬
<script language="javascript">
function saveUserInfo()
{
//»ñÈ¡½ÓÊÜ·µ»ØÐÅÏ¢²ã
var msg = document.getElementById("msg");
//»ñÈ¡±íµ¥¶ÔÏóºÍÓû§ÐÅÏ¢Öµ
var f = document.user_info;
var userName = f.user_name.value;
var userAge = f.user_age.value;
var userSex = f.user_sex.value;
//½ÓÊÕ±íµ¥µÄURLµØÖ·
var url = "/login_mng.php";
//ÐèÒªPOSTµÄÖµ£¬°Ñÿ¸ö±äÁ¿¶¼Í¨¹ý&À´Áª½Ó
var postStr = "user_name="+ userName +"&user_age="+ userAge +"&user_sex="+ userSex;
//alert(postStr);
//ʵÀý»¯Ajax
//var ajax = InitAjax();
var ajax = false;
//¿ªÊ¼³õʼ»¯XMLHttpRequest¶ÔÏó
if(window.XMLHttpRequest) { //Mozilla ä¯ÀÀÆ÷
ajax = new XMLHttpRequest();
if (ajax.overrideMimeType) {//ÉèÖÃMiMEÀà±ð
ajax.overrideMimeType("text/xml");
}
}
else if (window.ActiveXObject) { // IEä¯ÀÀÆ÷
try {
ajax = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
Ïà¹ØÎÊ´ð£º
RT£¡
xmlHttpRequest.send("Ìá½»²ÎÊýÃû=Öµ&Ìá½»²ÎÊýÃû1=Öµ");
var date={"Êý¾Ý1":"Êý¾Ý1Öµ","Êý¾Ý2":"Êý¾Ý2Öµ","Êý¾Ý3":"Êý¾Ý3Öµ" ......
index.phpÄÚÈÝ£º
$smarty->assign('name',strtotime('-0'));
$smarty->display("index.html");
index.htmlÄÚÈÝ£º
{$name|date_format:'%Y-%m-%d'}<hr>
{$ ......
´úÂëÖУ¬Èç¹û½«//alert(1)¡¡×¢ÊÍ´ò¿ª£¬ÄÇô¾Í¿ÉÒÔµ÷Óã¬Èç¹û×¢Ê͵ô¾ÍÎÞ·¨µ÷ÓÃ
»³ÒÉÊǵ¼JSÎļþ³öÎÊÌâÁË£¬ÒòΪд¹ýjspÒýÁ½¸öJSÎļþûÎÊÌ⣬
¶øJSPÒýÒ»¸öJSÎļþ£¬Õâ¸öJSÒý±ðÍâµÄJSÎļþ³öÏÖÏÂÃæÎÊÌ⣬ÉÏÍøÕÒÁË°ëÌìû½á ......
ÔÚfirefoxä¯ÀÀÆ÷ÏÂÕý³£µÇ½£¬µ«ÔÚIE ä¯ÀÀÆ÷ÏÂÎÞ·¨µÇ½£¬Ã¿´Î¶¼»áÖØÐÂÉú³ÉÒ»¸ösession,ÔÀ´µÄÄÚÈݻᶪʧ¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£Ôõô»ØÊÂ......
¾ßÌåÇé¿ö£¿²Â²â¿ÉÄÜÊÇÄã±¾»úIEµÄcookie±»½ûÓÃÁË°É£¬¿ÉÒÔ¿´¿´
cookie Æ ......
ÈçÌ⣬Ôõôд¸öheadÍ·²¿ ÈÃÒ³Ã滺´æ1ÐÇÆÚ¡£
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
Äã°ÑÀïÃæµÄʱ¼ä£¬¸Ä³Éµ±Ç°Ê±¼ä¼ÓÉÏÒ»¸öÐÇÆÚ
¼ÇµÃҪת»»³Égmtʱ¼ä
ÎÒÕâÑùдµÄ ²»ÖªµÀÐв»ÐС£
Ò»¸öÐ ......