• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP subscribe函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: charges

                 } else {
                     $query = "insert into charges (`charge`, `user_id`, `cause`, `date`) values ('" . $payment_gross . "', '" . mysql_escape_string($buyer_id) . "', 'Payment made for Item Number {$ItemNum}', '" . time() . "')";
                     $sum->query($query);
                     $query = "insert into charges (`charge`, `user_id`, `cause`, `date`) values ('-" . $payment_gross . "', '" . mysql_escape_string($buyer_id) . "', 'Payment used to start Item Number {$ItemNum}', '" . time() . "')";
                     $sum->query($query);
                     startlistingnow($ItemNum, $buyer_id);
                 }
             } elseif ($lookdb->f("amt_due") > $payment_gross) {
                 $query = "insert into charges (`charge`, `user_id`, `cause`, `date`) values ('" . $payment_gross . "', '" . mysql_escape_string($buyer_id) . "', 'Payment for Item Number {$ItemNum}  :: Error - The Amount Paid Was Less Than The Amount Due - Amount paid has been added to your account, but your listing has not been started', '" . time() . "')";
                 $sum->query($query);
                 $failed = "Error: The Amount Paid Was Less Than The Amount Due - Amount paid has been added to your account, but your listing has not been started";
             }
         }
     }
 } elseif (ltrim(end(explode("-", $item_name))) == "Subscription") {
     subscribe($payer_id, $item_number, $payment_gross);
     if ($payer_id) {
         $lookdb->query("SELECT * FROM users WHERE user_id='" . $payer_id . "'");
         if ($lookdb->next_record()) {
             $ld = array("first" => $lookdb->f("first_name"), "last" => $lookdb->f("last_name"), "user_login" => $lookdb->f("user_login"), "email" => $lookdb->f("email"), "address" => $lookdb->f("address1"), "address2" => $lookdb->f("address2"), "state" => $lookdb->f("state_id"), "zip" => $lookdb->f("zip"), "city" => $lookdb->f("city"), "phonedy" => $lookdb->f("phone_day"), "phoneevn" => $lookdb->f("phone_evn"), "fax" => $lookdb->f("fax"), "ip" => $lookdb->f("ip_insert"), "date_created" => $lookdb->f("date_created"));
         }
     }
     $EP["EMAIL:PAYMENT_SUBJECT"] = "PayPal Subscription";
     $EP["EMAIL:PAYMENT_AMOUNT"] = $charges["currency"] . $payment_gross;
     $EP["EMAIL:PAYER_EMAIL"] = $payer_email;
     $EP["EMAIL:CURRENT_USERNAME"] = $ld["user_login"];
     $EP["EMAIL:CURRENT_USERID"] = $ld["ID"];
     $EP["EMAIL:CURRENT_USER_FIRST_NAME"] = $ld["first"];
     $EP["EMAIL:CURRENT_USER_LAST_NAME"] = $ld["last"];
     $EP["EMAIL:CURRENT_USER_EMAIL"] = $ld["email"];
     $EP["EMAIL:CURRENT_USER_ADDRESS"] = $ld["address"];
开发者ID:4v4t4r,项目名称:CTF-LCC,代码行数:31,代码来源:paypalipn.php


示例17: array

//the minimum required fields
$usage = array("AccountId" => $newAccountId, "Quantity" => 5, "StartDateTime" => '2010-04-08T12:22:22', "UOM" => 'Each');
$result = uploadUsages($instance, array($usage));
print "\nUsage Created: " . $result->result->Id;
print "\n-------------------------------------------------------------------------------";
print "\nUSE CASE #10:QUERY PRODUCT CATALOG";
print "\n-------------------------------------------------------------------------------";
$query = "SELECT Id, Name FROM Product";
$records = queryAll($instance, $query);
print "\nAll Product count:" . count($records);
print "\n-------------------------------------------------------------------------------";
print "\nUSE CASE #11:GENERATE INVOICE";
print "\n-------------------------------------------------------------------------------";
# GENERATE & QUERY & POST INVOICE
print "\nGenerating Invoice...";
$result = subscribe($instance, $ProductRatePlan, false, false);
$success = $result->result->Success;
$accountId = $success ? $result->result->AccountId : "";
if ($accountId) {
    $invoiceDate = date('Y-m-d\\TH:i:s');
    $targetDate = date('Y-m-d\\TH:i:s', strtotime('+2 month', strtotime($invoiceDate)));
    $result = generateInvoice($instance, $accountId, $invoiceDate, $targetDate);
    $success = $result->result->Success;
    $msg = $success ? $result->result->Id : $result->result->Errors->Code . " (" . $result->result->Errors->Message . ")";
    print "\nInvoice Created: " . $msg . "\n";
    if ($success) {
        # QUERY Invoice
        $query = "SELECT Id, InvoiceNumber,Status FROM Invoice WHERE id = '" . $result->result->Id . "'";
        $records = queryAll($instance, $query);
        print "\nInvoice Queried ({$query}): " . $records[0]->InvoiceNumber . " " . $records[0]->Status . "\n";
        # POST Invoice
开发者ID:SonomaJack,项目名称:Wellbeing,代码行数:31,代码来源:main.php


示例18: timeout_timeout_does_not_occur

 /**
  * @test
  */
 public function timeout_timeout_does_not_occur()
 {
     $xs = $this->createHotObservable([onNext(70, 1), onNext(130, 2), onNext(240, 3), onNext(320, 4), onNext(410, 5), onCompleted(500)]);
     $ys = $this->createColdObservable([onNext(50, -1), onNext(200, -2), onNext(310, -3), onCompleted(320)]);
     $results = $this->scheduler->startWithCreate(function () use($xs, $ys) {
         return $xs->timeout(100, $ys);
     });
     $this->assertMessages([onNext(240, 3), onNext(320, 4), onNext(410, 5), onCompleted(500)], $results->getMessages());
     $this->assertSubscriptions([subscribe(200, 500)], $xs->getSubscriptions());
     $this->assertSubscriptions([], $ys->getSubscriptions());
 }
开发者ID:voryx,项目名称:Rx.PHP,代码行数:14,代码来源:TimeoutTest.php


示例19: connectable_observable_multiple_non_overlapped_connections

 /**
  * @test
  */
 public function connectable_observable_multiple_non_overlapped_connections()
 {
     $xs = $this->createHotObservable([onNext(210, 1), onNext(220, 2), onNext(230, 3), onNext(240, 4), onNext(250, 5), onNext(260, 6), onNext(270, 7), onNext(280, 8), onNext(290, 9), onCompleted(300)]);
     $subject = new TestSubject();
     $conn = $xs->multicast($subject);
     $c1 = null;
     $this->scheduler->scheduleAbsolute(225, function () use(&$c1, $conn) {
         $c1 = $conn->connect();
     });
     $this->scheduler->scheduleAbsolute(241, function () use(&$c1) {
         $c1->dispose();
     });
     $this->scheduler->scheduleAbsolute(245, function () use(&$c1) {
         $c1->dispose();
     });
     // idempotency test
     $this->scheduler->scheduleAbsolute(251, function () use(&$c1) {
         $c1->dispose();
     });
     // idempotency test
     $this->scheduler->scheduleAbsolute(260, function () use(&$c1) {
         $c1->dispose();
     });
     // idempotency test
     $c2 = null;
     $this->scheduler->scheduleAbsolute(249, function () use(&$c2, $conn) {
         $c2 = $conn->connect();
     });
     $this->scheduler->scheduleAbsolute(255, function () use(&$c2) {
         $c2->dispose();
     });
     $this->scheduler->scheduleAbsolute(265, function () use(&$c2) {
         $c2->dispose();
     });
     // idempotency test
     $this->scheduler->scheduleAbsolute(280, function () use(&$c2) {
         $c2->dispose();
     });
     // idempotency test
     $c3 = null;
     $this->scheduler->scheduleAbsolute(275, function () use(&$c3, $conn) {
         $c3 = $conn->connect();
     });
     $this->scheduler->scheduleAbsolute(295, function () use(&$c3) {
         $c3->dispose();
     });
     $results = $this->scheduler->startWithCreate(function () use($xs, $conn) {
         return $conn;
     });
     $this->assertMessages([onNext(230, 3), onNext(240, 4), onNext(250, 5), onNext(280, 8), onNext(290, 9)], $results->getMessages());
     $this->assertSubscriptions([subscribe(225, 241), subscribe(249, 255), subscribe(275, 295)], $xs->getSubscriptions());
 }
开发者ID:voryx,项目名称:Rx.PHP,代码行数:55,代码来源:ConnectableObservableTest.php


示例20: groupDispatch

function groupDispatch($op)
{
    if (isset($_POST['undo'])) {
        $op = 'groups';
    }
    if (isset($_POST['cancelselector'])) {
        $op = 'groups';
    }
    if (isset($_POST['okselector'])) {
        $op = 'savemembers';
    }
    switch ($op) {
        case "groups":
            groups();
            break;
        case "subscribe":
            subscribe();
            break;
        case "savemembers":
            savemembers();
            break;
        case "editgroup":
            editgroup();
            break;
        case "savegroup":
            savegroup();
            break;
        case "delgroup":
            delgroup();
            break;
    }
}
开发者ID:abhinay100,项目名称:forma_app,代码行数:32,代码来源:groups.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP subsite_manager_on_subsite函数代码示例发布时间:2022-05-23
下一篇:
PHP subnet_size函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap