GoAhead网页提交内容
2015-08-18 22:24
411 查看
<span style="font: 14px/21px 微软雅黑; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;">提交的方式有两种get和post</span><div style="font: 14px/21px 微软雅黑; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;">get:</div><div style="font: 14px/21px 微软雅黑; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;"> 这种传送方式所传输的内容有长度限制,一般在一百多字节以内。但是它所传送的 特殊字符 不需要的转换。</div><div style="font: 14px/21px 微软雅黑; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;"><br style="background-color: inherit;" /></div><div style="font: 14px/21px 微软雅黑; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;">post:</div><div style="font: 14px/21px 微软雅黑; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;"> 这种传送方式的内容可以比较大,可以大于2048字节,传送文件也是用这种方式,传送文件需要在form里添加</div><div style="font: 14px/21px 微软雅黑; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;">enctype="multipart/form-data"。</div><div style="font: 14px/21px 微软雅黑; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;"> post不加文件传输方式的话,传送的内容和get的一样,不过特殊字符就需要自己手动转换如:</div><blockquote style="font: 14px/21px 微软雅黑; margin: 0px 0px 0px 40px; padding: 0px; border: currentColor; border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;"><div style="background-color: inherit;">1. + URL 中+号表示空格 %2B</div><div style="background-color: inherit;">2. 空格 URL中的空格可以用+号或者编码 %20</div><div style="background-color: inherit;">3. / 分隔目录和子目录 %2F</div><div style="background-color: inherit;">4. ? 分隔实际的 URL 和参数 %3F</div><div style="background-color: inherit;">5. % 指定特殊字符 %25</div><div style="background-color: inherit;">6. # 表示书签 %23</div><div style="background-color: inherit;">7. & URL 中指定的参数间的分隔符 %26</div><div style="background-color: inherit;">8. = URL 中指定参数的值 %3D</div></blockquote><span style="font: 14px/21px 微软雅黑; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;"> 这些特殊字符以经过提交时防止出错转换的,转换的规则是“%”+“特殊字符的ascii码的十六进制”,</span><div style="font: 14px/21px 微软雅黑; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;">转换的函数可以参考:</div>
void WebTransUrl(const char *apcSrc, char* apcDst, int aiSize){int i = 0;int lnDstId = 0;while((i < aiSize - 1) && apcSrc[i]){if ('+' == apcSrc[i]){apcDst[lnDstId] = ' ';}else if ('%' == apcSrc[i]){apcDst[lnDstId] = (((unsigned char)apcSrc[i + 1] - '0') << 4 ) | ((unsigned char)apcSrc[i + 2] - '0');i += 2;}else{apcDst[lnDstId] = apcSrc[i];}++i;++lnDstId;}apcDst[lnDstId] = 0;}
相关文章推荐
- django1.8.3搭建博客——1
- Moist (cin,getline的区别)
- uva 11383 Golden Tiger Claw (KM算法)
- google镜像
- HDOJ1709特殊的母函数
- 集训第六周 古典概型 期望 D题 Discovering Gold 期望
- [algorithm] graph algorithm
- UVALive 6129 Sofa, So Good
- UVALive 6124 Hexagon Perplexagon
- django That port is already in use
- category和protocol 第五天稍晚了一些。
- Algorithms—80.Remove Duplicates from Sorted Array II
- AGFA 3rd MUSICA algorithm
- HDU 1036 Average is not Fast Enough!(水题)
- go language
- HDU 1029 Ignatius and the Princess IV
- django session使用方法
- hdoj 3635 Dragon Balls
- Google Doc搬运工:常用LDAP查询
- xcode 在哪里新建category、protocol等文件