$servername = trim($_SERVER['SERVER_NAME']);
$verifyurl = file_get_contents('http://localhost/token.php?domain='.$servername);
if(!empty($verifyurl)){
}else{
die("没有找到!");
}
如何把这段PHP代码改为JS代码,想加在JS里面
$servername = trim($_SERVER['SERVER_NAME']);
$verifyurl = file_get_contents('http://localhost/token.php?domain='.$servername);
if(!empty($verifyurl)){
}else{
die("没有找到!");
}
如何把这段PHP代码改为JS代码,想加在JS里面
不过javascript跨域设置很麻烦
$.ajax({
data:{domain:window.location.hostname},
dataType: "txt",
type: "get",
url: "http://localhost/token.php",
success: function(data){
if(data==''){
}else{
alert("没有找到!")
}
});