我正在使用 xcode 进行编码,并且正在使用 phpscript 从我的数据库中获取信息。
我有一个看起来像这样的 phpScript:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
echo "你好";
?>
问题是,当我尝试使用 NSLog 在 xcode 中打印出来时。
它在我不想要的控制台中打印:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
你好
它应该只是显示:
你好
我在 xcode 中使用这些代码来获取信息:
NSString *strURL = [NSString stringWithFormat:@"http://www.???.com/getcountry.php"];
// to execute php code
NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]];
// to receive the returend value
NSString *strResult = [[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding];
请指教,谢谢。