我有一个从数据库中选择的IPv4 IP列表,它将地址存储为BINARY(16)。有没有简单的方法将IPv6格式化地址转换为人类可读的IPv4格式?
这就是IPv4地址8ab8:7f70::
答案 0 :(得分:0)
正如Ron Maupin所描述的那样,解决方案非常简单
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src * 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<script type="text/javascript" charset="utf-8">
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() { alert("Version 1.10 is Ready"); }
$.support.ajax = true;
$.support.cors = true;
$.mobile.allowCrossDomainPages = true;
function SaveContact() {
var Contact = new Object();
Contact.Name = "Harvinder";
Contact.Phone = "9819862717";
Contact.Profile = "Director";
var myData = JSON.stringify(Contact);
var myURL = "http://gsecurity.net/JsonDAL.asmx/SaveContact";
alert("DataType:" + typeof (myData));
$.ajax({
type: "POST", contentType: "application/json", dataType: "json",
url: myURL, data: myData, allowCrossDomainPages: true,
success: function (msg) { alert("Success"); },
error: function (e, status) { alert("Failed:" + e.statusText); }
});
alert("Completed");
}
</script>
</head>
<body>
<h2>Call Ajax to Save Json Data with WebService</h2>
<button onclick="SaveContact()">Click Here to Save Test Contact</button>
<script type="text/javascript" src="../scripts/jquery-3.1.0.min.js"></script>
<script type="text/javascript" src="../scripts/jquery.mobile-1.4.5.min.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="scripts/platformOverrides.js"></script>
<script type="text/javascript" src="scripts/appBundle.js"></script>
</body>
</html>