首頁 >後端開發 >php教程 > JS代码转成PHP代码,该如何处理

JS代码转成PHP代码,该如何处理

WBOY
WBOY原創
2016-06-13 12:37:01883瀏覽

JS代码转成PHP代码

<script type="text/javascript"><br />
function rightSide(playerID) {<br />
    this.Decrypt2 = function(data) {<br />
        var b = (7 * (data - 6) % 10 + 10) % 10;<br />
        return b.toString();<br />
		alert(b.toString());<br />
    }<br />
<br />
    this.Decrypt = function(playerID) {<br />
        playerID = playerID.toString();<br />
        var arrID = new Array();<br />
        for (var i = 0; i < playerID.length; i = i + 1) {<br />
            var a = playerID.substr(i, 1);<br />
<br />
            switch (a) {<br />
                case "0": arrID.push(this.Decrypt2(0)); break;<br />
                case "4": arrID.push(this.Decrypt2(1)); break;<br />
                case "5": arrID.push(this.Decrypt2(2)); break;<br />
                case "3": arrID.push(this.Decrypt2(3)); break;<br />
                case "6": arrID.push(this.Decrypt2(4)); break;<br />
                case "9": arrID.push(this.Decrypt2(5)); break;<br />
                case "7": arrID.push(this.Decrypt2(6)); break;<br />
                case "1": arrID.push(this.Decrypt2(7)); break;<br />
                case "2": arrID.push(this.Decrypt2(8)); break;<br />
                case "8": arrID.push(this.Decrypt2(9)); break;<br />
            }<br />
        }<br />
        return arrID.join('');<br />
    }<br />
	return this.Decrypt(playerID);<br />
}	<br />
var idArr = rightSide(5705);


以上JS代码,帮忙转成PHP代码,谢谢各位了!!!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn