通过GET或者POST参数获取从前端浏览器传递的表示页码的参数page,并判断page的值是

通过GET或者POST参数获取从前端浏览器传递的表示页码的参数page,并判断page的值是,第1张

这个是简单的input

1、html前端(使用POST传值)代码

<!Doctype html>

<html lang="zh-CN">

<head>

<meta charset="utf-8">

<title>Form  Page</title>

</head>

<body>

<form method="post" action="1php">

    <label>转到第</lable><input type="text" name="page">页<br>

    <input type="submit" value="提交" name="submit">

</form>

</body>

</html>

2、1php代码

<php

$page = is_int($_POST['page'];

if(!$page){

    echo "页码格式错误";

}else{

    echo "你看到的是"$page"页";

}

function is_int($page){

    $reg = '/[0-9]/';

    if(preg_match($reg, $page){

        return $page;

    }else{

        return false;

    }

}

>

         const nowstr = new Date();

          const datenow = nowstrgetFullYear()

                    + ((nowstrgetMonth() + 1) < 10 "0" : "") + (nowstrgetMonth() + 1)

                    + (nowstrgetDate() < 10 "0" : "") + nowstrgetDate()

                    + (nowstrgetHours() < 10 "0" : "") + nowstrgetHours()

                    + (nowstrgetMinutes() < 10 "0" : "") + nowstrgetMinutes()

                    + (nowstrgetSeconds() < 10 "0" : "") + nowstrgetSeconds();

consolelog(datenow)

201907220000

好像jquery未封装有直接获取的方法,请参考javascript原生方法:

>

以上就是关于通过GET或者POST参数获取从前端浏览器传递的表示页码的参数page,并判断page的值是全部的内容,包括:通过GET或者POST参数获取从前端浏览器传递的表示页码的参数page,并判断page的值是、获取时间格式为YYYYMMDDHHMMSS、jquery如何快速获取页面的get传值等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/9543410.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-29
下一篇2023-04-29

发表评论

登录后才能评论

评论列表(0条)

    保存