zoukankan      html  css  js  c++  java
  • urlEncodeComponent

    To avoid unexpected requests to the server, you should call encodeURIComponent on any user-entered parameters that will be passed as part of a URI. For example, a user could type "Thyme &time=again" for a variable comment. Not using encodeURIComponent on this variable will give comment=Thyme%20&time=again. Note that the ampersand and the equal sign mark a new key and value pair. So instead of having a POST comment key equal to "Thyme &time=again", you have two POST keys, one equal to "Thyme " and another (time) equal to again.

    如果用户输入的部分要作为请求url, 这时用户可能会输入单双引号和空格或者&, 这也许并不是输入用户的本意,于是我们就要把字符转码, 试图还原输入的本意。

  • 相关阅读:
    绘制程序流程图笔记
    强软弱虚引用
    安全点和安全区域
    垃圾回收算法
    垃圾回收相关算法
    内存访问全过程
    多级页表与快表
    分页
    虚拟内存
    内存分段机制
  • 原文地址:https://www.cnblogs.com/qinqiu/p/8599687.html
Copyright © 2011-2022 走看看