最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Pass text with special characters as get parameter in php - Stack Overflow

programmeradmin2浏览0评论

I want to pass any text as a get parameter to a php script. For know I just append the text this way:

action.php?text=Hello+my+name+is+bob

This url is posed by javascript and I do a ajax request with this url.

In action.php I do

$encoded = array_map('rawurlencode', $_GET);

But this does not work for special chars like ÖÄüä.

Any idea how to solve this?

I want to pass any text as a get parameter to a php script. For know I just append the text this way:

action.php?text=Hello+my+name+is+bob

This url is posed by javascript and I do a ajax request with this url.

In action.php I do

$encoded = array_map('rawurlencode', $_GET);

But this does not work for special chars like ÖÄüä.

Any idea how to solve this?

Share Improve this question edited Mar 6, 2011 at 18:29 DarkLeafyGreen asked Mar 6, 2011 at 18:11 DarkLeafyGreenDarkLeafyGreen 70.5k136 gold badges391 silver badges616 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

url_encode(string) will return the given string with special characters converted into %XX format.

https://www.php/manual/en/function.urlencode.php

I know you can send special characters fine without encoding through $_POST, which is another alternative

try with url_encode().........

发布评论

评论列表(0)

  1. 暂无评论