php: 怎么向服务器发送post or get 中文

WBOY
Release: 2016-06-13 13:30:20
Original
859 people have browsed it

php: 如何向服务器发送post or get 中文?
比如我要向localhost:12345 发送get命令。我使用的是
file_get_contents("http://localhost:12345?q="."名字")
因为最后的q里面含有名字,不知道为什么总是服务器端接收的不好。服务器端我使用的是java,进行的url.decode(),但是好像解码不了.php发送过来的是中文这种东西。怎么办

------解决方案--------------------
不要直接进行中文的POST,post之前进行编码,甚至可以进行二次编码,然后使用时进行二次解码就行了,编码方式可以随意,只要可还原就行了

但要注意字符集...utf-8和gbk不能混用

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!