<script>? ?? ? ? ?let obj = {? ? ? ? ? ?name:'Alice',? ? ? ? ? ?age:100,? ? ? ? ? ?sex:'man',? ? ? ? ? ?class:'1905'? ? ? ?}? ?? ? ? ?// 將對象轉換成字符串拼接的格式? ? ? ?function objtostring(obj) {? ? ? ? ? ?let arr=[];? ? ? ? ? ?for(let i in obj){? ? ? ? ? ? ? ?arr.push(i+'='+obj[i]);? ? ? ? ? ?}? ? ? ? ? ?return arr.join('&');? ? ? ?}? ? ? ?console.log(objtostring(obj));? ? ? ?? ? ? ?let request = new ?XMLHttpRequest();? ? ? ?request.open('get','http://10.31.158.12/day23/get.php?'+objtostring(obj),true);? ? ? ?request.send();? ? ? ?request.onreadystatechange = function(){? ? ? ? ? ?if(request.readyState==4){? ? ? ? ? ? ? ? ? ?if(request.status==200){? ? ? ? ? ? ? ? ? ?}? ? ? ? ? ? ? ? ? ?else {? ? ? ? ? ? ? ? ? ? ? ?throw new Error('接口地址有誤:'+request.status);? ? ? ? ? ? ? ? ? ?}? ? ? ? ? ?}? ? ? ?}? ?</script><?php// ?header('content-type:text/html;charset=utf-8');// error_reporting(0);echo $_GET["name"];?>
pup輸入之后,顯示空白
寶慕林6116383
2019-06-21 12:56:17