【问题标题】:php encode text before send method get urlphp在发送方法获取url之前对文本进行编码
【发布时间】:2020-02-29 11:36:26
【问题描述】:

我使用 get 方法发送 ex: Name: Pie; 28 岁。 单击提交按钮时 网址如data.php?name=pie&age=28

但我不喜欢其他看年龄,想编码年龄(MD5)。

data.php?name=pie&age=6F4922F45568161A8CDF4AD2299F6D23

那么我该如何编辑我的代码:

<form action="<?php $_PHP_SELF ?>" method="GET">
    Name: <input type="text" name="name" />
    age: <input type="text" name="<?php echo md5("age"); ?>" />
    <input type="submit" />
</form>

【问题讨论】:

  • 你应该使用编码base64_encode()和解码base64_decode()
  • 您应该使用POST 而不是GET
  • @Bluetree 他想编码年龄。
  • md5 散列只是一种方式,为什么还要对其进行编码?
  • @RobinSingh 我建议他改成POST 方法。为什么要使用GET 方法?

标签: php search methods get


【解决方案1】:

如果您不希望其他人看到您的数据,最好使用方法 Post 而不是 Get,但如果您坚持使用哈希来保护您的代码,则不建议使用 md5。检查password_hash

【讨论】:

    【解决方案2】:

    你可以用openssl_encrypt加密,openssl_decrypt解密。

    【讨论】:

      猜你喜欢
      • 2012-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-19
      • 2014-06-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多