在 mysql 数据库表中
varchar title(20) - db table column.
title: Banana™ - table row.
在 return.php (服务器)
$get_query=$_GET['query'];
$connect=mysql_connect("localhost","root","") or die("die");
mysql_select_db("testdb",$connect);
$query=mysql_query($get_query,$connect);
while($row = mysql_fetch_array($query ))
{
$list[]=$row;
}
print json_encode($list);
mysql_free_result($query);
mysql_close($connect);
在 ios (客户端)
NSString * szURL =[NSString stringWithFormat:@"http://localhost/return.php?query=%@",query];
NSURL *url = [NSURL URLWithString:[szURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding ]];
NSString *strData = [NSString stringWithContentsOfURL:url
encoding:NSUTF8StringEncoding
error:&error];
NSDictionary *rootItem = (NSDictionary *)[strData JSONValue];
NSArray * appLists= (NSArray *)rootItem;
NSMutableArray *resultArray =[[[NSMutableArray alloc]init] autorelease];
for(NSDictionary * oneApp in appLists)
{
NSString *appTitle=(NSString*)[oneApp objectForKey:@"title"];
}
但 appTitle 为 NULL;
我想,我需要隐藏角色。
™ 是问题。我如何通过 (NSString *) 获得 Banana™?