我正在尝试执行一个在后台线程中返回NSString的选择器,返回的NSString将取决于输入对象albumlink.
我在后台执行它,因为缩短URL需要一段时间.
如果你能告诉我如何获得返回字符串,我将非常感激.
我执行该选择器的代码是:
[self performSelectorInBackground:@selector(shortenURL:) withObject:albumlink];
Run Code Online (Sandbox Code Playgroud) 我有一个名为"goto"的目录和一个名为index.php的文件.目前,以下内容位于index.php文件中:
<?php
$url = $_GET['url'];
header("Location: $url");
?>
Run Code Online (Sandbox Code Playgroud)
目前要重定向到另一个URL,我必须在地址栏中输入:
http://mysite.com/goto/?url=http://google.com
Run Code Online (Sandbox Code Playgroud)
如果您能告诉我如何更改该URL以便我可以通过在地址栏中输入以下内容将用户重定向到网站,我将不胜感激:
http://mysite.com/goto/http://google.com
Run Code Online (Sandbox Code Playgroud) 我的 Mac 上有一个 FAT .a 存档(一个库),我只是想知道如何从中提取文件?
我正在尝试使用以下代码通过CSS设置页面的背景图像,但没有显示图像.图像将在页面上平铺,仅为10x10px.尽管如此,它仍然没有出现.请你告诉我我做错了什么?
<body>
<div id="background"></div>
</body>
#background {
background-image: url("img/background.png");
}
Run Code Online (Sandbox Code Playgroud) 目前,我有一个带有输入(文本)和按钮的表单来提交表单.
表单将发布到"submit.php".我希望将表单发布到与表单相同的页面.
我怎样才能做到这一点?
<form action="submit.php" method="POST">
<input type="text" class="emailField" placeholder="email address" name="email" />
<button type="submit">
<div class="submit" />
</button>
</form>
Run Code Online (Sandbox Code Playgroud)
submit.php
<?php
mysql_connect('localhost', '', '') or die('unable to connect');
mysql_select_db('') or die('unable to select db');
$query = mysql_query("");
if (mysql_num_rows($query) > 0) {
exit("You have already subscribed!");
}
else {
mysql_query("") or die(mysql_error());
exit("You have successfully subscribed!");
}
?>
Run Code Online (Sandbox Code Playgroud) 如何在不收到错误的情况下检查NSMutableArray中的对象是否为nil index .. beyond bounds for empty array?我使用以下代码收到错误:
if (![self.sortedArray objectAtIndex:[alphabet indexOfObject:[NSString stringWithFormat:@"%c", (char) [letter characterAtIndex:0]]]]) {
NSMutableArray *arr = [NSMutableArray arrayWithObject:countryDict];
[self.sortedArray addObject:arr];
}
else {
[[self.sortedArray objectAtIndex:[alphabet indexOfObject:[NSString stringWithFormat:@"%c", (char) [letter characterAtIndex:0]]]] addObject:countryDict];
}
Run Code Online (Sandbox Code Playgroud) 我是CodeIgniter的新手,但不是PHP新手,我想知道我需要在CodeIgniter中做些什么才能使我的所有查询都安全.
通常情况下,我只是用mysql_real_escape_string()在查询(标准PHP)中使用的每个变量,但我看了笨,这里笔者没有逃脱变量的教程,只是做了一个标准的插入类似如下:
$this->db->query("SELECT * FROM Users WHERE Username = ?", array($username));
Run Code Online (Sandbox Code Playgroud)
哪种方式是正确的?
我正在尝试显示文本"我是来自英国伦敦的iOS工程师和网络开发人员",并div以"伦敦"ID为中心.但是,我正在努力找到一个好方法.水平对齐很容易,因为我只需要设置text-align'伦敦' 的属性div.但是,当尝试垂直对齐时,我无法设置width和height属性意味着我无法使用margin: 0 auto;垂直对齐文本,因为我正在使用span元素.
请告诉我最好的方法来实现这个目标?
这是一个JSFiddle,我现在拥有的东西:http://jsfiddle.net/5aX7p/.
我在MKMapView中添加了一些注释,当用户点击其中一个注释时,它会显示一个带有正确附件按钮的UICalloutView,它会向地图添加一个UIView,显示有关该特定位置的一些信息.这个UIView以地图的超视图为中心,为了显示该视图中的信息是相对于注释的,我想将可见地图rect向下移动(在y轴上),并将其置于x轴使注释直接位于视图下方.
我正在执行以下操作以使注释居中,但是,我不知道如何在y轴上向下移动注释以使其位于添加的UIView下面.请问您能告诉我怎么做?
[self.mapView setCenterCoordinate:[annotation coordinate] animated:YES];
Run Code Online (Sandbox Code Playgroud) 我想将一个视图从一个位置动态移动到一个新的位置.如果更新视图的图层位置,我认为视图将动画移动到新位置,implicit animation我猜,但是没有动画,为什么?
- (IBAction)startAnimation:(id)sender {
CGPoint position = self.imageView.layer.position;
position.y += 90;
self.imageView.layer.position = position;
}
Run Code Online (Sandbox Code Playgroud)