Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/244.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
STHTTPRequest“&;char";如何将此字符发送到php页面?_Php_Ios_Character Encoding_Sthttprequest - Fatal编程技术网

STHTTPRequest“&;char";如何将此字符发送到php页面?

STHTTPRequest“&;char";如何将此字符发送到php页面?,php,ios,character-encoding,sthttprequest,Php,Ios,Character Encoding,Sthttprequest,我的ios应用程序必须通过一些php页面发送/检索一些日期。这是一个使用i STHTTPRequest的示例调用: __block STHTTPRequest *up = [STHTTPRequest requestWithURLString:[NSString stringWithFormat:@"%@%@",PATHSERVER,@"retrivedata.php"]]; up.encodePOSTDictionary=NO; up.postDataEncoding=NSUTF8Stri

我的ios应用程序必须通过一些php页面发送/检索一些日期。这是一个使用i STHTTPRequest的示例调用:

 __block STHTTPRequest *up = [STHTTPRequest requestWithURLString:[NSString stringWithFormat:@"%@%@",PATHSERVER,@"retrivedata.php"]];

up.encodePOSTDictionary=NO;
up.postDataEncoding=NSUTF8StringEncoding;

up.POSTDictionary = @{@"name":@"Name", @"surname":@"Surname"};
在我决定插入以下内容之前,一切正常:

up.POSTDictionary = @{@"name":@"Na&me", @"surname":@"Surname"};
就这样

 print_r($_POST);
在retrivedata.php中,结果是:

Array
(
 [name] => Na
 [surname] => Surname

)
名称在“&”字符索引处剪切。我尝试过一些类似的方法,但没有成功:

utf8_encode/utf8_decode($name)
看来retrvedata.php的名字已经被切掉了,所以我不能使用任何字符转换/编码。。。在我的STHTTPRequest中,我已经尝试设置:

up.encodePOSTDictionary=YES;
使用此设置,我可以将“&”作为$amp;但是如果我做了一个选择来检索这个值,我就不能通过

 html_entity_decode();
它仍然存在

&

我该怎么办?我的STHTTPRequest发送'Na&me',但retrievepage.php中的$\u POST[]是空的

我对shttprequest不太熟悉,但您应该对它进行url编码。当URL编码时,它看起来像“Na%26me”。在稍后的帖子中,您将看到“Na&me”

希望有帮助:)