zoukankan      html  css  js  c++  java
  • php输入流简单小例子

    <form method="post" action="index.php/home/index/captchaTest">
        <input name="name" id="name" type="text" placeholder="name" />
        <input name="age" id="age" type="text" placeholder="age" />
        <input name="email" id="email" type="text" placeholder="email" />
        <input name="captcha" id="captcha" type="text" placeholder="captcha" />
        <img src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?'+Math.random();" />
        <input name="tijiao" type="button" value="提交" />
    </form>
    <script type="text/javascript" src="__STATIC__/js/jquery.min.js"></script>
    <script type="text/javascript">
        $(':button').click(function(){
            var para = {};
            para['name'] = $('#name').val();
            para['age'] = $('#age').val();
            para['email'] = $('#email').val();
            para['captcha'] = $('#captcha').val();
            $.ajax({
                type: "post",
                url: "{:url('captchaTest')}",
                data: JSON.stringify(para),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function(result){
                    console.log(result);
                },
                error: function(result){}
            })
        })
    </script>
    public function captchaTest(){
            $content = file_get_contents("php://input");
            return json_decode($content, true);
    }
  • 相关阅读:
    jmap之使用说明与JVM配置
    Linux之tomcat日志管理
    服务器连接数与资源监控
    Git命令之资源
    状态机
    分布式之消息系统架构
    Memcache之内存分配机制
    LRU算法
    Linux(Ubuntu)之设定开机自启动
    mysql 查询 优化
  • 原文地址:https://www.cnblogs.com/xwlong/p/7851392.html
Copyright © 2011-2022 走看看