if (isset($_POST['agree'])) { // 判断 POST 请求中的 cid 是否是本篇文章的 cid if ($_POST['agree'] == $this->cid) { // 调用点赞函数,传入文章的 cid,然后通过 exit 输出点赞数量 exit(agree($this->cid)); } // 如果点赞的文章 cid 不是本篇文章的 cid 就输出 error 不再往下执行 exit('error'); }

javascript实现两个数字进行组合

javascript实现两个数字进行组合
javascript实现两个数字进行组合
实现任意两个数字,前面数字与后面数字组合

<!DOCTYPE html>
<html lang="en">

<head>
          <meta charset="UTF-8">
          <meta http-equiv="X-UA-Compatible" content="IE=edge">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <title>Number-Combination</title>
</head>

<body>
          <input id="bnum" type="number" placeholder="请输入开始数字" />
          <input id="enum" type="number" placeholder="请输入结束数字" />
          <input type="button" id='calc' value="排列组合" />
          <script>

                    var btn = document.getElementById('calc')
                    btn.onclick = function () {
                              var beginnum = document.getElementById('bnum').value.toString();
                              var endnum = document.getElementById('enum').value.toString();
                              comb(beginnum, endnum)
                    }
                    function comb(a, b) {
                              this.a = a.split('');
                              this.b = b.split('');
                              var len = this.a.lenght * this.b.lenght;
                              var temp = new Array();
                              for (var o = 0; o < this.a.length; o++) {
                                        for (p = 0; p < this.b.length; p++) {
                                                  console.log(this.a[o] + this.b[p])
                                                  let newDiv = document.createElement("div");
                                                  let newContent = document.createTextNode(this.a[o] + this.b[p]);
                                                  newDiv.appendChild(newContent);
                                                  let currentDiv = document.getElementById("div1");
                                                  document.body.insertBefore(newDiv, currentDiv);
                                        }
                              }
                    }
          </script>
</body>

</html>
来都来了,留个言吧🙂