HTML代码
解析
header('Content-type:application/json; charset=utf-8');
!empty($_GET['url']) ? $url = $_GET['url'] : exit(json_encode(['code'=>202,"msg"=>"参数错误"],JSON_UNESCAPED_UNICODE));
$api = file_get_contents('https://umapi.top/api/dy.php?url='.$url);
$data = json_decode($api,true);
echo json_encode($data,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);$(document).ready(function(){
$('#button').click(function (){
var text = $('#url').val();
if (text == '') {
alert('域名不能为空');
return false;
}
$.ajax({
url:'api.php',
type:'get',
dataType:'json',
data: {url:text},
beforeSend: function(){
$("#load").html('
$("head").prepend(meta);
},
success:function(data){
if (data.code == 200) {
var mkhtml = '
'+data.title+'
$(".watermark").html(mkhtml);
$("#load").empty();
}else{
alert(data.msg);
$("#load").empty();
}
}
});
});
});
HTML、API、JS都给你们了,剩下的就靠自己了,会的人应该一看就懂,分享给大家学习。