zoukankan      html  css  js  c++  java
  • ThinkPHP

    Html代码:

    <!DOCTYPE html>
    <html lang="zh-cn">
        <head>
            <meta charset="utf-8" />
            <title>修改验证码配置文件</title>
            <link rel="stylesheet" href="__PUBLIC__/Css/Public.css">
        </head>
        <body>
            <form action="<{:U(GROUP_NAME . '/System/setVerify')}>" method="post">
                <table class="table">
                    <tr>
                        <th colspan="2">验证码配置</th>
                    </tr>
                    <tr>
                        <td align="right">验证码字典:</td>
                        <td><input type="text" name="charset" value="<{$Think.config.charset}>" /></td>
                    </tr>
                    <tr>
                        <td align="right">验证码长度:</td>
                        <td><input type="text" name="codelen" value="<{$Think.config.codelen}>" /></td>
                    </tr>
                    <tr>
                        <td align="right">验证码宽度:</td>
                        <td><input type="text" name="width" value="<{$Think.config.width}>" /></td>
                    </tr>
                    <tr>
                        <td align="right">验证码高度:</td>
                        <td><input type="text" name="height" value="<{$Think.config.height}>" /></td>
                    </tr>
                    <tr>
                        <td align="right">验证码字体文件位置:</td>
                        <td><input type="text" name="font" value="<{$Think.config.font}>" /></td>
                    </tr>
                    <tr>
                        <td align="right">验证码字体大小:</td>
                        <td><input type="text" name="fontsize" value="<{$Think.config.fontsize}>" /></td>
                    </tr>
                    <tr>
                        <td align="right">Session名称</td>
                        <td><input type="text" name="verifyName" value="<{$Think.config.verifyName}>" /></td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center">
                            <input type="submit" value="保存更新" style="cursor:pointer;" />
                        </td>
                    </tr>
                </table>
            </form>
        </body>
    </htm

    PHP代码:

        /**
         * 验证码表单
         */
        Public function setVerify() {
            if ( !IS_POST ) $this->redirect(GROUP_NAME . '/Syatem/verify');
    
            //使用F函数,重写配置文件
            if ( F('verify', $_POST, CONF_PATH) ) {
                $this->success('写入成功!', U( GROUP_NAME . '/System/verify'));
            } else {
                $this->error('写入失败, 请检查文件夹:' . CONF_PATH . '是否具有写入权限!');
            }
        }

    生成文件:

    <?php    return array ( 'charset' => 'abcdefghkmnprstuvwxyzABCDEFGHKMNPRSTUVWXYZ23456789', 'codelen' => '2', 'width' => '130', 'height' => '50', 'font' => './App/Data/QDB.otf', 'fontsize' => '30', 'verifyName' => 'verify', );?>
  • 相关阅读:
    strncat_s
    资源编译器 (.rc) 文件
    C++ Namespace 详解
    Structure Definitions
    SetParent
    C++笔记(1)explicit构造函数
    .def
    tellg()和tellp()
    Data Groups
    Messages
  • 原文地址:https://www.cnblogs.com/KTblog/p/5190509.html
Copyright © 2011-2022 走看看