当前位置: 首页>>代码示例>>PHP>>正文


PHP subscribe函数代码示例

本文整理汇总了PHP中subscribe函数的典型用法代码示例。如果您正苦于以下问题:PHP subscribe函数的具体用法?PHP subscribe怎么用?PHP subscribe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了subscribe函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testToArrayDisposed

 public function testToArrayDisposed()
 {
     $xs = $this->createHotObservable([onNext(110, 1), onNext(220, 2), onNext(330, 3), onNext(440, 4), onNext(550, 5)]);
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs->toArray();
     });
     $this->assertMessages([], $results->getMessages());
     $this->assertSubscriptions([subscribe(200, 1000)], $xs->getSubscriptions());
 }
开发者ID:bluetechy,项目名称:Rx.PHP,代码行数:9,代码来源:ToArrayTest.php

示例2: it_passes_on_completed_from_sources

 /**
  * @test
  */
 public function it_passes_on_completed_from_sources()
 {
     $ys = $this->createHotObservable(array(onCompleted(250)));
     $results = $this->scheduler->startWithCreate(function () use($ys) {
         return Observable::mergeAll($ys);
     });
     $this->assertMessages(array(onCompleted(250)), $results->getMessages());
     $this->assertSubscriptions(array(subscribe(200, 250)), $ys->getSubscriptions());
 }
开发者ID:voryx,项目名称:Rx.PHP,代码行数:12,代码来源:MergeAllTest.php

示例3: subscribeOn_never

 /**
  * @test
  */
 public function subscribeOn_never()
 {
     $xs = $this->createHotObservable([onNext(150, 1)]);
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs->subscribeOn($this->scheduler);
     });
     $this->assertMessages([], $results->getMessages());
     $this->assertSubscriptions([subscribe(201, 1001)], $xs->getSubscriptions());
 }
开发者ID:voryx,项目名称:Rx.PHP,代码行数:12,代码来源:SubscribeOnTest.php

示例4: pluck_array_numeric_index

 /**
  * @test
  */
 public function pluck_array_numeric_index()
 {
     $xs = $this->createHotObservable([onNext(180, [-1, -1, -1, -1]), onNext(210, [4, 3, 2, 1]), onNext(240, [4, 3, 20, 10]), onNext(290, [4, 3, 200, 100]), onNext(350, [4, 3, 2000, 1000]), onCompleted(400)]);
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs->pluck(2);
     });
     $this->assertMessages([onNext(210, 2), onNext(240, 20), onNext(290, 200), onNext(350, 2000), onCompleted(400)], $results->getMessages());
     $this->assertSubscriptions([subscribe(200, 400)], $xs->getSubscriptions());
 }
开发者ID:ReactiveX,项目名称:RxPHP,代码行数:12,代码来源:PluckTest.php

示例5: it_passes_the_last_on_complete

 /**
  * @test
  */
 public function it_passes_the_last_on_complete()
 {
     $xs = $this->createColdObservable(array(onNext(100, 4), onNext(200, 2), onNext(300, 3), onNext(400, 1), onCompleted(500)));
     $ys = $this->createColdObservable(array(onNext(50, 'foo'), onNext(100, 'bar'), onNext(150, 'baz'), onNext(200, 'qux'), onCompleted(250)));
     $results = $this->scheduler->startWithCreate(function () use($xs, $ys) {
         return $xs->merge($ys);
     });
     $this->assertMessages(array(onNext(250, 'foo'), onNext(300, 4), onNext(300, 'bar'), onNext(350, 'baz'), onNext(400, 2), onNext(400, 'qux'), onNext(500, 3), onNext(600, 1), onCompleted(700)), $results->getMessages());
     $this->assertSubscriptions(array(subscribe(200, 700)), $xs->getSubscriptions());
     $this->assertSubscriptions(array(subscribe(200, 450)), $ys->getSubscriptions());
 }
开发者ID:ReactiveX,项目名称:RxPHP,代码行数:14,代码来源:MergeTest.php

示例6: flatMapTo_it_passes_on_error

 /**
  * @test
  */
 public function flatMapTo_it_passes_on_error()
 {
     $xs = $this->createColdObservable(array(onNext(100, 4), onNext(200, 2), onNext(300, 3), onNext(400, 1), onCompleted(510)));
     $ys = $this->createColdObservable(array(onNext(50, 'foo'), onNext(100, 'bar'), onNext(150, 'baz'), onError(210, new Exception()), onCompleted(250)));
     $results = $this->scheduler->startWithCreate(function () use($xs, $ys) {
         return $xs->flatMapTo($ys);
     });
     $this->assertMessages(array(onNext(350, "foo"), onNext(400, "bar"), onNext(450, "baz"), onNext(450, "foo"), onNext(500, "bar"), onError(510, new Exception())), $results->getMessages());
     $this->assertSubscriptions(array(subscribe(200, 510)), $xs->getSubscriptions());
     $this->assertSubscriptions(array(subscribe(300, 510), subscribe(400, 510), subscribe(500, 510)), $ys->getSubscriptions());
 }
开发者ID:ReactiveX,项目名称:RxPHP,代码行数:14,代码来源:SelectManyTest.php

示例7: charges_AfterInsert

function charges_AfterInsert()
{
    //charges_AfterInsert @4-B46BA208
    //Custom Code @13-2A29BDB7
    global $now;
    global $EP;
    global $regcharges;
    global $Tpl;
    subscribe(CCGetUserID(), $_REQUEST["id"], $this->charge->DBValue);
    mailout("NewSubscribe", $now["notifyads"], CCGetUserID(), 1000000000, time(), $EP);
    //End Custom Code
}
开发者ID:4v4t4r,项目名称:CTF-LCC,代码行数:12,代码来源:subscribe_events.php

示例8: defaultIfEmpty_empty_2

 /**
  * @test
  */
 public function defaultIfEmpty_empty_2()
 {
     $xs = $this->createHotObservable([onCompleted(420)]);
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs->defaultIfEmpty(new ReturnObservable(-1));
     });
     // Note: these tests differ from the RxJS tests that they were based on because RxJS was
     // explicitly using the immediate scheduler on subscribe internally. When we pass the
     // proper scheduler in, the subscription gets scheduled which requires an extra tick.
     $this->assertMessages([onNext(421, -1), onCompleted(421)], $results->getMessages());
     $this->assertSubscriptions([subscribe(200, 420)], $xs->getSubscriptions());
 }
开发者ID:voryx,项目名称:Rx.PHP,代码行数:15,代码来源:DefaultIfEmptyTest.php

示例9: doit

function doit()
{
    global $HTTP_POST_VARS, $mytrail, $auth, $sess;
    if (get_notification_method($auth->auth['uname'], $mytrail['id']) != -1) {
        change_subscription($auth->auth['uname'], $mytrail['id'], $newn);
    } else {
        subscribe($auth->auth['uname'], $mytrail['id'], $newn);
    }
    $str = "";
    if ($HTTP_POST_VARS['reloadparent'] == "1") {
        $str = "?reloadparent=1";
    }
    header("Location: " . $sess->url($mytrail['path'] . $str));
}
开发者ID:pilif,项目名称:linktrail,代码行数:14,代码来源:editsubs.php

示例10: defer_dispose

 /**
  * @test
  */
 public function defer_dispose()
 {
     $invoked = 0;
     $xs = null;
     $results = $this->scheduler->startWithCreate(function () use(&$invoked, &$xs) {
         return Observable::defer(function () use(&$invoked, &$xs) {
             $invoked++;
             $xs = $this->createColdObservable([onNext(100, $this->scheduler->getClock()), onNext(200, $invoked), onNext(1100, 1000)]);
             return $xs;
         });
     });
     $this->assertMessages([onNext(300, 200), onNext(400, 1)], $results->getMessages());
     $this->assertEquals(1, $invoked);
     $this->assertSubscriptions([subscribe(200, 1000)], $xs->getSubscriptions());
 }
开发者ID:ReactiveX,项目名称:RxPHP,代码行数:18,代码来源:DeferTest.php

示例11: response

/**
 * response all msg
 * @param $postObj
 * @return string
 */
function response($postObj)
{
    $log = new Logs();
    $return = '';
    $msgType = $postObj->MsgType;
    $logmsg = '[user] ' . $postObj->FromUserName . ' [msg-type] ' . $msgType;
    switch ($msgType) {
        case MSGTYPE_EVENT:
            $logmsg .= ' [event] ' . $postObj->Event;
            switch ($postObj->Event) {
                case 'subscribe':
                    //关注
                    $return = subscribe($postObj);
                    break;
                case 'unsubscribe':
                    unsubscribe($postObj);
                    break;
                case 'CLICK':
                    switch ($postObj->EventKey) {
                        case 'MENU_NEWS':
                            $return = news($postObj);
                            break;
                    }
            }
            break;
        case MSGTYPE_TEXT:
            //txt
            $logmsg .= ' [content] ' . $postObj->Content;
            $return = textResponse($postObj);
            break;
        default:
            $return = news($postObj);
            break;
    }
    if (!$log->write_log($logmsg, 'access')) {
        if (DEBUG) {
            echo 'error: ' . $log->error;
        }
    }
    return $return;
}
开发者ID:lampjian,项目名称:wechat-quick-start,代码行数:46,代码来源:wechat.php

示例12: min_some_dispose

 /**
  * @test
  */
 public function min_some_dispose()
 {
     $error = new \Exception();
     $xs = $this->createHotObservable([onNext(150, 'z'), onNext(210, 'b'), onNext(220, 'c'), onNext(230, 'a')]);
     $results = $this->scheduler->startWithDispose(function () use($xs, $error) {
         return $xs->min();
     }, 400);
     $this->assertMessages([], $results->getMessages());
     $this->assertSubscriptions([subscribe(200, 400)], $xs->getSubscriptions());
 }
开发者ID:ReactiveX,项目名称:RxPHP,代码行数:13,代码来源:MinTest.php

示例13: page_head

{
    BoincSubscription::delete($user->id, $thread->id);
    if (!BoincSubscription::lookup($user->id, $thread->id)) {
        page_head(tra("Unsubscription successful"));
        show_forum_header($user);
        show_title($forum, $thread);
        echo "<p>" . tra("You are no longer subscribed to %1. You will no longer receive notifications for this thread.", "<b>" . cleanup_title($thread->title) . "</b>");
    } else {
        page_head(tra("Unsubscription failed"));
        echo "<p>" . tra("We are currently unable to unsubscribe you from %1. Please try again later..", "<b>" . cleanup_title($thread->title) . "</b>");
    }
    echo "</p><p><br /><a href=\"forum_thread.php?id=" . $thread->id . "\">" . tra("Return to thread") . "</a></p>";
    page_tail();
}
if (!$thread || !$action) {
    error_page(tra("Unknown subscription action"));
}
$user = get_logged_in_user();
check_tokens($user->authenticator);
if ($action == "subscribe") {
    subscribe($forum, $thread, $user);
    exit;
} else {
    if ($action == "unsubscribe") {
        unsubscribe($forum, $thread, $user);
        exit;
    }
}
?>

开发者ID:CalvinZhu,项目名称:boinc,代码行数:29,代码来源:forum_subscribe.php

示例14: partitionDisposed

 /**
  * @test
  */
 public function partitionDisposed()
 {
     $xs = $this->createHotObservable([onNext(180, 5), onNext(210, 4), onNext(240, 3), onNext(290, 2), onNext(350, 1), onCompleted(360)]);
     $observables = null;
     $s1 = null;
     $s2 = null;
     $r1 = $this->scheduler->createObserver();
     $r2 = $this->scheduler->createObserver();
     $this->scheduler->scheduleAbsolute(TestScheduler::CREATED, function () use(&$observables, $xs) {
         $observables = $xs->partition([$this, 'isEven']);
     });
     $this->scheduler->scheduleAbsolute(TestScheduler::SUBSCRIBED, function () use(&$observables, &$s1, &$s2, $r1, $r2) {
         $s1 = $observables[0]->subscribe($r1);
         $s2 = $observables[1]->subscribe($r2);
     });
     $this->scheduler->scheduleAbsolute(280, function () use(&$s1, &$s2) {
         $s1->dispose();
         $s2->dispose();
     });
     $this->scheduler->start();
     $this->assertMessages([onNext(210, 4)], $r1->getMessages());
     $this->assertMessages([onNext(240, 3)], $r2->getMessages());
     $this->assertSubscriptions([subscribe(200, 280), subscribe(200, 280)], $xs->getSubscriptions());
 }
开发者ID:ReactiveX,项目名称:RxPHP,代码行数:27,代码来源:PartitionTest.php

示例15: addToTestAdminQueue

function addToTestAdminQueue($uid, $pid)
{
    if (!canTestAdminPuzzle($uid, $pid)) {
        return FALSE;
    }
    $sql = sprintf("INSERT INTO testAdminQueue (uid, pid) VALUES ('%s', '%s')", mysql_real_escape_string($uid), mysql_real_escape_string($pid));
    query_db($sql);
    // Subscribe testadmins to comments on their puzzles
    subscribe($uid, $pid);
}
开发者ID:paultag,项目名称:puzzle-editing,代码行数:10,代码来源:utils.php


注:本文中的subscribe函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。