In
js ajaxThe following is the case:
var xhr = new XMLHttpRequest(); // 下面的第四个,第五个参数怎么使用?? xhr.open('get' , 'authorization.php' , true , username , password); xhr.send();
So far have not used ajax open the method of the fourth, the fifth parameter, write Ajax operation class today when the fourth, fifth parameters is always a lump, want to thoroughly understand him.
The web says it needs to be available on the http 基本认证的 page 第四个,第五个参数 .
But I just don't understand php页面怎么弹出认证框 ?
I have tried:
header('Authorization: username:password');
But this is supposed to be the case, ajax 请求中头设置 anyway, php 这一块怎么弄?? no clue.
Can you post this to 认证的 js 代码, php 代码 study (temporarily not involved oAuth 认证 , first learn the most original ha, and then on oAuth )?
Reply content:
In the js ajax following scenario:
var xhr = new XMLHttpRequest(); // 下面的第四个,第五个参数怎么使用?? xhr.open('get' , 'authorization.php' , true , username , password); xhr.send();
So far have not used ajax open the method of the fourth, the fifth parameter, write Ajax operation class today when the fourth, fifth parameters is always a lump, want to thoroughly understand him.
The web says it needs to be available on the http 基本认证的 page 第四个,第五个参数 .
But I just don't understand php页面怎么弹出认证框 ?
I have tried:
header('Authorization: username:password');
But this is supposed to be the case, ajax 请求中头设置 anyway, php 这一块怎么弄?? no clue.
Can you post this to 认证的 js 代码, php 代码 study (temporarily not involved oAuth 认证 , first learn the most original ha, and then on oAuth )?
Just now, want to be PHP to collect others, basic certification, the official example:
HTTP Authentication with PHP
Hello {$_SERVER['PHP_AUTH_USER']}."; echo "
You entered {$_SERVER['PHP_AUTH_PW']} as your password.
"; }?>
The normal network request status is 200, you want the browser to pop up the Basic authentication window, return to status 401 can