zoukankan      html  css  js  c++  java
  • php 生成表单 | url串禁止转义并解决中文字符乱码

    function create_auto_html($params, $action)
    {
        $encodeType = isset ($params ['encoding']) ? $params ['encoding'] : 'UTF-8';
        $html = <<<eot
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset={$encodeType}" />
    </head>
    <body  onload="javascript:document.pay_form.submit();">
        <form id="pay_form" name="pay_form" action="{$action}" method="post">
    
    eot;
        foreach ($params as $key => $value) {
            $html .= "    <input type="hidden" name="{$key}" id="{$key}" value="{$value}" />
    ";
        }
        $html .= <<<eot
        </form>
    </body>
    </html>
    eot;
        return $html;
    }
    View Code

    url串禁止转义并解决中文字符乱码:

    $data = array(
        'devi'         => 'y',
        'ap'             => 'ios',
        'user'         => 'w5807',
        'login'     => '随便',
        'loginpwd'         => 'e10adc3949ba59abbe56e057f20f883e',
        'mobile'     => '15555555555',
        'regReferee'    => 'aaa',
        'atm'    => 'e10adc3949ba59abbe56e057f20f883e'
    );
    $c_data = urldecode(htmlspecialchars(http_build_query($data)));//禁止字符串转义和中文字符乱码

    ——————————————————

  • 相关阅读:
    java8 日期时间之间的关系
    redis bind连不上的坑
    mysql 表结构转excel表格
    软件工程实践总结
    Beta答辩总结
    Beta 冲刺(7/7)
    Beta 冲刺(6/7)
    Beta 冲刺(5/7)
    Beta 冲刺(4/7)
    Beta 冲刺(3/7)
  • 原文地址:https://www.cnblogs.com/cuizhenyu/p/10604223.html
Copyright © 2011-2022 走看看