如何在http POST请求中发送HTML代码? [英] How to send HTML code in an http POST request?

查看:337
本文介绍了如何在http POST请求中发送HTML代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是从Google Web Toolkit应用向PHP脚本发送HTTP POST请求。内容类型是application / x-www-form-urlencoded,所以我可以发送变量到php,并在php中使用 $ _ POST [] 我认为我可以在其中一个变量中正确地发送HTML标记。

I am an sending a HTTP POST request from a Google Web Toolkit app to a php script. The content-type is "application/x-www-form-urlencoded" right now so I can send variables to php and use $_POST[] in php but I don't think I can properly send HTML markup inside one of the variables.

这是我的:
post_data = var1 = true& var2 = true $ html =HTML MARKUP HERE

当这样做的时候,几乎没有任何html通过php进入 $ _ POST ['html'] 变量。在POST变量中完成发送html标记的正确方法是什么?感谢。

When doing it this way barely any of the html comes through to php in the $_POST['html'] variable. What is the proper method to accomplish sending html markup in a POST variable. Thanks.

推荐答案

百分比编码查询参数。在JavaScript中,您可以使用 encodeURIComponent 功能

Percent-encode the query parameter. In JavaScript, you can use the encodeURIComponent function.

这篇关于如何在http POST请求中发送HTML代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆