當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。