我在iphone中使用webservice進行編程,它訪問包含「Mobile & gaming solutions」等值的mysql數據庫。我從用戶的字符串中獲取這個值並傳遞給php文件。但PHP不接受'&'的字符串。它只接受「移動」。幫我。我在Xcode代碼:從xcode到php的字符串中傳遞'&'?
strEditbuunit = [labeditbunit.text stringByReplacingOccurrencesOfString:@" " withString:@"+"];
NSString *Updpost =[NSString stringWithFormat:@"buname=%@",strEditbuunit];
UpdLTRhostStr = @"http://localhost/practice/ltrupdate.php?";
UpdLTRhostStr = [UpdLTRhostStr stringByAppendingString:Updpost];
UpdLTRdataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:UpdLTRhostStr]];
UpdLTRserverOutput = [[NSString alloc] initWithData:UpdLTRdataURL encoding: NSASCIIStringEncoding];
<?php
$con = mysql_connect("192.168.0.82","android","android");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("androidlogin", $con);
$buname = $_GET["buname"];
$retval1 = mysql_query("SELECT code_id FROM typedescs where name = '$buname'");
while($row1 = mysql_fetch_assoc($retval1))
{
$bu_id = $row1['code_id'];
}
echo $buname;
mysql_close($con);
?>
當我回聲buname它給了我「移動」而不是因「&」「移動&遊戲解決方案。」請幫助我如何將特殊字符的字符串傳遞給xcode中的php。
不錯[SQL注入漏洞](http://bobby-tables.com)。享受你的服務器pwn3d。 – 2013-03-26 05:31:27