如何在php中使用javascript函数?
我有以下javascript代码:如何在php中使用javascript函数?,javascript,php,Javascript,Php,我有以下javascript代码: var _keyStr = "ZYX10+/PONM765LKJIAzyTSRQGxwvuHWVFEDUCBtsrqdcba9843ponmlkjihgfe2"; function _utf8_decode(e) { for (var t = "", i = 0, o = c1 = c2 = 0; i < e.length;)(o = e.charCodeAt(i)) < 128 ? (t += String.fromCharCode(o
var _keyStr = "ZYX10+/PONM765LKJIAzyTSRQGxwvuHWVFEDUCBtsrqdcba9843ponmlkjihgfe2";
function _utf8_decode(e) {
for (var t = "", i = 0, o = c1 = c2 = 0; i < e.length;)(o = e.charCodeAt(i)) < 128 ? (t += String.fromCharCode(o), i++) : o > 191 && o < 224 ? (c2 = e.charCodeAt(i + 1), t += String.fromCharCode((31 & o) << 6 | 63 & c2), i += 2) : (c2 = e.charCodeAt(i + 1), c3 = e.charCodeAt(i + 2), t += String.fromCharCode((15 & o) << 12 | (63 & c2) << 6 | 63 & c3), i += 3);
return t
}
function decode(e) {
var t, i, o, s, a, r, n = "",
l = 0;
for (e = e.replace(/[^A-Za-z0-9+\/=]/g, ""); l < e.length;) t = _keyStr.indexOf(e.charAt(l++)) << 2 | (s = _keyStr.indexOf(e.charAt(l++))) >> 4, i = (15 & s) << 4 | (a = _keyStr.indexOf(e.charAt(l++))) >> 2, o = (3 & a) << 6 | (r = _keyStr.indexOf(e.charAt(l++))), n += String.fromCharCode(t), 64 != a && (n += String.fromCharCode(i)), 64 != r && (n += String.fromCharCode(o));
return n = _utf8_decode(n)
}
var _keyStr=“ZYX10+/PONM765LKJIAzyTSRQGxwvuHWVFEDUCBtsrqdcba9843ponmlkjihgfe2”;
功能_utf8_解码(e){
对于(var t=”,i=0,o=c1=c2=0;i191&&o<224?(c2=e.charCodeAt(i+1),t+=String.fromCharCode((31&o),从它的外观来看,它只是一个自定义键对的base64?那么为什么不这样做呢
function decode($input) {
$custom = 'ZYX10+/PONM765LKJIAzyTSRQGxwvuHWVFEDUCBtsrqdcba9843ponmlkjihgfe2';
$default = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
$decoded = base64_decode(strtr($input, $custom, $default));
return $input;
}
这是基于中的代码,从外观上看,它只是带有自定义密钥的base64,对吗?那么为什么不这样做呢
function decode($input) {
$custom = 'ZYX10+/PONM765LKJIAzyTSRQGxwvuHWVFEDUCBtsrqdcba9843ponmlkjihgfe2';
$default = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
$decoded = base64_decode(strtr($input, $custom, $default));
return $input;
}
这是基于