小编use*_*123的帖子

将IP重定向到域

Google搜索结果显示我的网页为(ip)/mypage.html而不是https://www.mydomain.com/mypage.html.我相信解决方案是将ip重定向到域.我发现了很多非常类似的方法,但是没有一个能为我工作.我有一个将http重定向到https的现有规则.这就是我的.htaccess文件目前的样子:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^11\.11\.11\.111$ [NC]
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^([a-z.]+)?mydomain\.com$ [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.mydomain.com/$1 [R=301,L]
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

ip dns .htaccess redirect

9
推荐指数
2
解决办法
4万
查看次数

沙箱排行榜空

我正在尝试为我的应用制作游戏中心排行榜.我一直在遵循Apple的步骤并遵循GKTapper的示例代码,但我无法在Game Center中显示任何分数.我在iTunes Connect中设置了排行榜.以下是报告分数的代码:

- (void) reportScore: (int64_t) score forCategory: (NSString *) category {
    GKScore *scoreReporter = [[[GKScore alloc] initWithCategory:category] autorelease];
    scoreReporter.value = score;

    [scoreReporter reportScoreWithCompletionHandler:^(NSError *error) {
        if (error != nil)
        {
            UIAlertView* alert= [[[UIAlertView alloc] initWithTitle: @"Score Report Failed!" message: [NSString stringWithFormat: @"Reason: %@", [error localizedDescription]] delegate: self cancelButtonTitle: @"Try Again..." otherButtonTitles: NULL] autorelease];
            [alert show];
        }
    }];
}
Run Code Online (Sandbox Code Playgroud)

代码似乎运行正常.警报永远不会显示.但是,当我进入Game Center时,排行榜是空白的.我正在运行Xcode 4.2和iOS 5.任何想法?

iphone leaderboard center sandbox

7
推荐指数
1
解决办法
2503
查看次数

UISwipeGestureRecognizer位置

我需要根据用户是否在屏幕顶部,屏幕中间或屏幕底部滑动来触发不同的事件.我正在试图找出最好/最简单的方法,因为我很确定没有办法从UISwipeGestureRecognizer获取位置.

第一个选项是使用'touches'方法创建我自己的滑动识别器.这似乎非常困难(例如,尝试区分滑动和拖动).

第二种可能性是从"触摸"方法之一(例如touchesBegan)获取位置,并以某种方式将其与滑动相关联.也许在touchesBegan中设置一个计时器,然后如果刷卡识别器在半秒左右的时间内触发,我就会知道滑动连接到那个触摸.

我能想到的第三种可能性是在我的视图上放置3个透明子视图,并为每个视图添加不同的滑动识别器.这对我来说似乎是最好的方式,除了透明视图无法识别触摸/滑动事件.那么我该如何解决这个问题呢?

有什么建议?谢谢.

iphone location gesture swipe uigesturerecognizer

4
推荐指数
1
解决办法
4436
查看次数

从onSubmit事件处理程序添加或减去函数?

我有以下代码:

function showAddrBox() {
    var prompt = document.getElementById('addr_prompt');
    prompt.style.display = 'block';
    document.generic_form.address.style.display = 'block';
    document.generic_form.onsubmit = validateAddrForm;
}

function hideAddrBox() {
    var prompt = document.getElementById('addr_prompt');
    prompt.style.display = 'none';
    document.generic_form.address.style.display = 'none';
    document.generic_form.onsubmit = null;
}
Run Code Online (Sandbox Code Playgroud)

问题是,有时候我想要保留onSubmit附加的附加功能.我希望能够在onSubmit事件中添加和删除单个函数,而不是仅使用"onsubmit ="进行设置.换句话说,我需要一种方法来完成这样的事情:

document.form.onsubmit += function;
document.form.onsubmit -= function;
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

javascript javascript-events onsubmit

3
推荐指数
2
解决办法
6137
查看次数

通过PHP mail()函数发送SMS时出现'From'标题

我正在使用PHP的mail()函数发送短信.它的工作正常,但是当我希望它显示为'test@mydomain.com'时,消息显示为来自'myuser@mr2.websitewelcome.com'.这是相关的代码:

//Set headers and send mail.
$headers = "From: " . "test@mydomain.com" . "\r\n";
$headers .= "Reply-To: ". "test@mydomain.com" . "\r\n";

mail( $from, '', $message, $headers );
Run Code Online (Sandbox Code Playgroud)

我知道之前已经问过这个问题,但到目前为止没有任何帮助.我已经尝试将标题设置为'-f test@mydomain.com'.没运气.

顺便说一句,如果我发送到电子邮件地址而不是电话号码,标题工作正常.

Idk如果这与它有关,但我的脚本是从我在cpanel中设置的邮件转发器调用的,如:

Address                 Forward To
test@mydomain.com       |/home/myuser/public_html/handler.php
Run Code Online (Sandbox Code Playgroud)

此外,以下是发送到电子邮件地址的电子邮件的完整标题:

Return-Path: <itch3@mr2.websitewelcome.com>
Received: from gateway01.websitewelcome.com (gateway01.websitewelcome.com [67.18.65.19])
    by mtain-mk01.r1000.mx.aol.com (Internet Inbound) with ESMTP id 1B28B3800008B
    for <myemail@me.com>; Wed,  8 Feb 2012 20:25:56 -0500 (EST)
Received: by gateway01.websitewelcome.com (Postfix, from userid 5007)
    id A69B35C21D4BD; Wed,  8 Feb 2012 19:25:55 -0600 (CST)
Received: from mr2.websitewelcome.com …
Run Code Online (Sandbox Code Playgroud)

php email sms header

2
推荐指数
1
解决办法
3766
查看次数

php mail()函数执行顺序错误

我有2个邮件功能,如下所示:

mail( $from, '', 'mail1', $headers );
mail( $from, '', 'mail2', $headers );
Run Code Online (Sandbox Code Playgroud)

如果我在$ from中使用我自己的电子邮件地址进行测试,有时我会先收到mail1,有时候会先收到mail2.我想先收到mail1.我尝试在两个邮件功能之间放置一个usleep,但它没有用.

php email sequence usleep

1
推荐指数
1
解决办法
153
查看次数