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


PHP finish函数代码示例

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


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

示例1: processbounces_shutdown

function processbounces_shutdown()
{
    global $report, $process_id;
    releaseLock($process_id);
    # $report .= "Connection status:".connection_status();
    finish('info', $report);
}
开发者ID:dehvCurtis,项目名称:phplist,代码行数:7,代码来源:processbounces.php

示例2: begun_or_not

function begun_or_not($page)
{
    global $duration, $diff;
    $connection = createConn();
    $var = -1;
    $sql_query = "SELECT * FROM googlockstart_end where no='0'";
    $temp = mysql_query($sql_query, $connection);
    $result = mysql_fetch_array($temp);
    finish($connection);
    $curr_timestamp = time();
    $diff = $curr_timestamp - $result['start_timestamp'];
    $duration = $result['finish_timestamp'] - $result['start_timestamp'];
    if ($diff < 0) {
        $msg = "Game has not started yet";
        $var = 0;
    } else {
        if ($curr_timestamp > $result['finish_timestamp']) {
            $msg = "Game has finished";
            $var = 1;
        } else {
            $msg = "Game has Started!!";
        }
    }
    if ($page == 1) {
        if ($var == 0) {
            header("location: index.php");
        } else {
            if ($var == 1) {
                header("location: login.php");
            }
        }
    } else {
        return $msg;
    }
}
开发者ID:Vidhan,项目名称:iFestSite,代码行数:35,代码来源:begun_or_not_scheme.php

示例3: ProcessError

function ProcessError($message)
{
    print "{$message}";
    logEvent("Error: {$message}");
    finish("error", $message);
    exit;
}
开发者ID:alancohen,项目名称:alancohenexperience-com,代码行数:7,代码来源:getrss.php

示例4: handle

function handle($uri = '')
{
    try {
        if (($matched = dispatch($uri)) != null) {
            if (!before()) {
                $handler = $matched['handler'];
                if (!empty($matched['options']['router'])) {
                    $handler = call_user_func($handler, $matched);
                }
                if (!empty($matched['options']['create'])) {
                    $controllerClass = $handler[0];
                    $handler[0] = new $controllerClass();
                }
                if (isset($matched['params'])) {
                    call_user_func_array($handler, $matched['params']);
                } else {
                    call_user_func_array($handler, $matched['segments']);
                }
                after();
            }
        } else {
            notFound();
        }
        finish();
    } catch (Exception $e) {
        error_log($e->getMessage());
        error_log($e->getTraceAsString());
    }
    exit;
}
开发者ID:rivetweb,项目名称:old-php-seomonitor,代码行数:30,代码来源:flacon.php

示例5: processTestEmails_shutdown

function processTestEmails_shutdown()
{
    global $report, $process_id;
    releaseLock($process_id);
    # $report .= "Connection status:".connection_status();
    finish('info', $report);
    if (!$GLOBALS["commandline"]) {
        include_once dirname(__FILE__) . '/footer.inc';
    }
}
开发者ID:dehvCurtis,项目名称:phplist,代码行数:10,代码来源:readtestmail.php

示例6: my_shutdown

function my_shutdown()
{
    global $script_stage, $reload;
    #  output( "Script status: ".connection_status(),0); # with PHP 4.2.1 buggy. http://bugs.php.net/bug.php?id=17774
    output($GLOBALS['I18N']->get('Script stage') . ': ' . $script_stage, 0, 'progress');
    global $counters, $report, $send_process_id, $tables, $nothingtodo, $invalid, $processed, $failed_sent, $notsent, $sent, $unconfirmed, $num_per_batch, $batch_period, $counters;
    $some = $processed;
    #$sent;# || $invalid || $notsent;
    if (!$some) {
        output($GLOBALS['I18N']->get('Finished, Nothing to do'), 0, 'progress');
        $nothingtodo = 1;
    }
    $totaltime = $GLOBALS['processqueue_timer']->elapsed(1);
    if ($totaltime > 0) {
        $msgperhour = 3600 / $totaltime * $sent;
    } else {
        $msgperhour = s('Calculating');
    }
    if ($sent) {
        output(sprintf('%d %s %01.2f %s (%d %s)', $sent, $GLOBALS['I18N']->get('messages sent in'), $totaltime, $GLOBALS['I18N']->get('seconds'), $msgperhour, $GLOBALS['I18N']->get('msgs/hr')), $sent, 'progress');
    }
    if ($invalid) {
        output(s('%d invalid email addresses', $invalid), 1, 'progress');
    }
    if ($failed_sent) {
        output(s('%d failed (will retry later)', $failed_sent), 1, 'progress');
        foreach ($counters as $label => $value) {
            #  output(sprintf('%d %s',$value,$GLOBALS['I18N']->get($label)),1,'progress');
            cl_output(sprintf('%d %s', $value, $GLOBALS['I18N']->get($label)));
        }
    }
    if ($unconfirmed) {
        output(sprintf($GLOBALS['I18N']->get('%d emails unconfirmed (not sent)'), $unconfirmed), 1, 'progress');
    }
    foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
        $plugin->processSendStats($sent, $invalid, $failed_sent, $unconfirmed, $counters);
    }
    flushClickTrackCache();
    releaseLock($send_process_id);
    finish("info", $report, $script_stage);
    if ($script_stage < 5 && !$nothingtodo) {
        output($GLOBALS['I18N']->get('Warning: script never reached stage 5') . "\n" . $GLOBALS['I18N']->get('This may be caused by a too slow or too busy server') . " \n");
    } elseif ($script_stage == 5 && (!$nothingtodo || isset($GLOBALS["wait"]))) {
        # if the script timed out in stage 5, reload the page to continue with the rest
        $reload++;
        if (!$GLOBALS["commandline"] && $num_per_batch && $batch_period) {
            if ($sent + 10 < $GLOBALS["original_num_per_batch"]) {
                output($GLOBALS['I18N']->get('Less than batch size were sent, so reloading imminently'), 1, 'progress');
                $delaytime = 10;
            } else {
                // we should actually want batch perion minus time already spent.
                // might be nice to calculate that at some point
                output(sprintf($GLOBALS['I18N']->get('Waiting for %d seconds before reloading'), $batch_period), 1, 'progress');
                $delaytime = $batch_period;
            }
            sleep($delaytime);
            printf('<script type="text/javascript">
        document.location = "./?page=pageaction&action=processqueue&ajaxed=true&reload=%d&lastsent=%d&lastskipped=%d";
      </script>', $reload, $sent, $notsent);
        } else {
            printf('<script type="text/javascript">
        document.location = "./?page=pageaction&action=processqueue&ajaxed=true&reload=%d&lastsent=%d&lastskipped=%d";
      </script>', $reload, $sent, $notsent);
        }
    } elseif ($script_stage == 6 || $nothingtodo) {
        foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
            $plugin->messageQueueFinished();
        }
        output($GLOBALS['I18N']->get('Finished, All done'), 0);
        print '<script type="text/javascript">
      var parentJQuery = window.parent.jQuery;
      window.parent.allDone("' . s('All done') . '");
      </script>';
    } else {
        output(s('Script finished, but not all messages have been sent yet.'));
    }
    if (empty($GLOBALS['commandline']) && empty($_GET['ajaxed'])) {
        include_once "footer.inc";
    } elseif (!empty($GLOBALS['commandline'])) {
        @ob_end_clean();
    }
    exit;
}
开发者ID:juvenal,项目名称:PHPlist,代码行数:83,代码来源:processqueue.php

示例7: ProcessError

function ProcessError ($message) {
  output( "$message");
  finish("error",$message);
  exit;
}
开发者ID:radicaldesigns,项目名称:amp,代码行数:5,代码来源:processqueue.php

示例8: scanner

function scanner($path, $node, $line)
{
    global $migrational, $items;
    switch ($path) {
        case '/blog':
            if (!preg_match('/^tattertools\\/1\\.[01]$/', @$node['.attributes']['type']) && !preg_match('/^textcube\\/1\\.[01]$/', @$node['.attributes']['type'])) {
                finish(_t('지원하지 않는 백업파일입니다.'));
            }
            $migrational = Validator::getBool(@$node['.attributes']['migrational']);
            return true;
        case '/blog/setting/banner/content':
        case '/blog/post/attachment/content':
        case '/blog/notice/attachment/content':
        case '/blog/keyword/attachment/content':
            if (!empty($node['.stream'])) {
                fclose($node['.stream']);
                unset($node['.stream']);
            }
            return true;
        case '/blog/setting':
        case '/blog/category':
        case '/blog/post':
        case '/blog/notice':
        case '/blog/keyword':
        case '/blog/link':
        case '/blog/logs/referer':
        case '/blog/statistics/referer':
        case '/blog/statistics/visits':
        case '/blog/statistics/daily':
        case '/blog/skin':
        case '/blog/plugin':
        case '/blog/commentNotified/comment':
        case '/blog/commentNotifiedSiteInfo/site':
        case '/blog/guestbook/comment':
        case '/blog/filter':
        case '/blog/feed':
        case '/blog/line':
            $items++;
            if (!strpos($path, 'referer')) {
                setProgress(null, _t('백업파일을 확인하고 있습니다.'), $line);
            }
            return true;
        case '/blog/personalization':
        case '/blog/userSetting':
            // skip
            return true;
    }
}
开发者ID:webhacking,项目名称:Textcube,代码行数:48,代码来源:index.php

示例9: test_is_running

}
function test_is_running()
{
    return $GLOBALS['current'] != '';
}
function loop_tests($cmd, $line_func)
{
    global $results;
    $ftest = popen($cmd, 'r');
    if (!$ftest) {
        echo "Couldn't run test script\n";
        exit(1);
    }
    while (!feof($ftest)) {
        $line = fgets($ftest);
        $line_func($line);
    }
    say(array('op' => 'all_done', 'results' => $results));
    fclose($ftest);
}
chdir(__DIR__ . '/../../../');
$cmd = "./hphp/tools/run_test_binary.sh " . "'{$argv['1']}' '{$argv['2']}' '{$argv['3']}' '{$argv['4']}' " . "2>/dev/null";
loop_tests($cmd, function ($line) {
    if (preg_match('/^(Test[a-zA-Z]*)\\.\\.\\.\\.\\.\\.$/', $line, $m)) {
        start($m[1]);
    } else {
        if (preg_match('/^Test[a-zA-Z]* (OK|\\#\\#\\#\\#\\#\\>\\>\\> FAILED)/', $line, $m)) {
            finish($m[1] == 'OK' ? 'passed' : 'failed');
        }
    }
});
开发者ID:RavuAlHemio,项目名称:hhvm,代码行数:31,代码来源:fbmake_test_binary_wrapper.php

示例10: finish

if ($mysqli->connect_errno) {
    $ret = "未能连接到数据库 (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
    finish($ret);
}
$id = $mysqli->real_escape_string($id);
$name = $mysqli->real_escape_string($name);
if ($res = $mysqli->query("SELECT ID FROM students WHERE stu_id = '{$id}' AND name = '{$name}'")) {
    if ($res->num_rows) {
        $row = $res->fetch_assoc();
        $stuid = $row['ID'];
    } else {
        finish("查无此人");
    }
} else {
    finish("查询失败!");
}
if ($res = $mysqli->query("SELECT * FROM time WHERE student_id = {$stuid} AND event = '{$event}'")) {
    echo "[";
    $i = false;
    while ($row = $res->fetch_assoc()) {
        if ($i) {
            echo ",";
        }
        $i = true;
        printf('{"day": "%s", "item": "%s"}', $row['day'], $row['item']);
    }
    echo "]";
} else {
    finish("查询失败");
}
$mysqli->close();
开发者ID:xuhongxu96,项目名称:timetable,代码行数:31,代码来源:load.php

示例11: getpage


//.........这里部分代码省略.........
        }
    }
    #if(header_value('Pragma')==null) header('Pragma: public');
    #if(header_value('Cache-Control')==null) header('Cache-Control: public');
    #if(header_value('Last-Modified')==null && header_value('Expires')==null) header('Expires: '.date('D, d M Y H:i:s e',time()+86400));
    if (empty($_COOKIE[COOK_PREF . '_remove_cookies'])) {
        $setcookiearr = header_value_arr('Set-Cookie');
        for ($i = 0; $i < count($setcookiearr); $i++) {
            $thiscook = explode('=', $setcookiearr[$i], 2);
            if (!strpos($thiscook[1], ';')) {
                $thiscook[1] .= ';';
            }
            $cook_val = substr($thiscook[1], 0, strpos($thiscook[1], ';'));
            $cook_domain = preg_replace('/^.*domain=[	 ]*\\.?([^;]+).*?$/i', '\\1', $thiscook[1]);
            #*
            if ($cook_domain == $thiscook[1]) {
                $cook_domain = $cook_prefdomain;
            } elseif (substr($cook_prefdomain, strlen($cook_prefdomain) - strlen($cook_domain), strlen($cook_domain)) != $cook_domain) {
                continue;
            }
            $cook_name = str_replace('.', '_', $cook_domain) . COOKIE_SEPARATOR . $thiscook[0];
            if (ENCRYPT_COOKS) {
                $cook_name = proxenc($cook_name);
                $cook_val = proxenc($cook_val);
            }
            dosetcookie($cook_name, $cook_val);
        }
    }
    if (substr($response, 0, 2) == '30' && $response[2] != '4') {
        $urlobj = new aurl($url);
        $redirurl = framify_url(surrogafy_url(header_value('Location'), $urlobj), NEW_PAGETYPE_FRAMED_PAGE);
        fclose($fp);
        restore_error_handler();
        finish_noexit();
        header("Location: {$redirurl}");
        exit;
    }
    $oheaders = preg_replace("/[\r\n](?:Location|Content-Length|Content-Encoding|Set-Cookie|Transfer-Encoding|Connection|Keep-Alive|Pragma|Cache-Control|Expires)\\: .*/i", null, $headers);
    #*
    $ohsplit = explode("\n", $oheaders);
    foreach ($ohsplit as $header) {
        if (!empty($header)) {
            header($header);
        }
    }
    unset($oheaders, $ohsplit);
    header('Status: ' . $response);
    if (substr(header_value('Content-Type'), 0, 4) == 'text' || substr(header_value('Content-Type'), 0, 24) == 'application/x-javascript') {
        $justoutput = false;
        $justoutputnow = false;
    } else {
        $justoutputnow = header_value('Content-Encoding') == 'gzip' ? false : true;
        $justoutput = true;
    }
    if (header_value('Transfer-Encoding') == 'chunked') {
        $body = null;
        $chunksize = null;
        while ($chunksize !== 0) {
            $byte = null;
            $chunk = null;
            while ($byte != "\r") {
                $chunk .= $byte;
                $byte = fread($fp, 1);
            }
            fread($fp, 1);
            $chunksize = intval($chunk, 16);
开发者ID:469306621,项目名称:Languages,代码行数:67,代码来源:surrogafier1.php

示例12: my_shutdown

function my_shutdown()
{
    global $script_stage, $reload;
    #  processQueueOutput( "Script status: ".connection_status(),0); # with PHP 4.2.1 buggy. http://bugs.php.net/bug.php?id=17774
    processQueueOutput(s('Script stage') . ': ' . $script_stage, 0, 'progress');
    global $counters, $report, $send_process_id, $tables, $nothingtodo, $processed, $notsent, $unconfirmed, $batch_period;
    $some = $processed;
    $delaytime = 0;
    if (!$some) {
        processQueueOutput($GLOBALS['I18N']->get('Finished, Nothing to do'), 0, 'progress');
        $nothingtodo = 1;
    }
    $totaltime = $GLOBALS['processqueue_timer']->elapsed(1);
    if ($totaltime > 0) {
        $msgperhour = 3600 / $totaltime * $counters['sent'];
    } else {
        $msgperhour = s('Calculating');
    }
    if ($counters['sent']) {
        processQueueOutput(sprintf('%d %s %01.2f %s (%d %s)', $counters['sent'], $GLOBALS['I18N']->get('messages sent in'), $totaltime, $GLOBALS['I18N']->get('seconds'), $msgperhour, $GLOBALS['I18N']->get('msgs/hr')), $counters['sent'], 'progress');
    }
    if ($counters['invalid']) {
        processQueueOutput(s('%d invalid email addresses', $counters['invalid']), 1, 'progress');
    }
    if ($counters['failed_sent']) {
        processQueueOutput(s('%d failed (will retry later)', $counters['failed_sent']), 1, 'progress');
        foreach ($counters as $label => $value) {
            #  processQueueOutput(sprintf('%d %s',$value,$GLOBALS['I18N']->get($label)),1,'progress');
            cl_output(sprintf('%d %s', $value, $GLOBALS['I18N']->get($label)));
        }
    }
    if ($unconfirmed) {
        processQueueOutput(sprintf($GLOBALS['I18N']->get('%d emails unconfirmed (not sent)'), $unconfirmed), 1, 'progress');
    }
    foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
        $plugin->processSendStats($counters['sent'], $counters['invalid'], $counters['failed_sent'], $unconfirmed, $counters);
    }
    flushClickTrackCache();
    releaseLock($send_process_id);
    finish('info', $report, $script_stage);
    if ($script_stage < 5 && !$nothingtodo) {
        processQueueOutput($GLOBALS['I18N']->get('Warning: script never reached stage 5') . "\n" . $GLOBALS['I18N']->get('This may be caused by a too slow or too busy server') . " \n");
    } elseif ($script_stage == 5 && (!$nothingtodo || isset($GLOBALS['wait']))) {
        # if the script timed out in stage 5, reload the page to continue with the rest
        ++$reload;
        if (!$GLOBALS['commandline'] && $counters['num_per_batch'] && $batch_period) {
            if ($counters['sent'] + 10 < $GLOBALS['original_num_per_batch']) {
                processQueueOutput($GLOBALS['I18N']->get('Less than batch size were sent, so reloading imminently'), 1, 'progress');
                $counters['delaysend'] = 10;
            } else {
                $counters['delaysend'] = (int) ($batch_period - $totaltime);
                $delaytime = 30;
                ## actually with the iframe we can reload fairly quickly
                processQueueOutput(s('Waiting for %d seconds before reloading', $delaytime), 1, 'progress');
            }
        }
        $counters['delaysend'] = (int) ($batch_period - $totaltime);
        if (empty($GLOBALS['inRemoteCall']) && empty($GLOBALS['commandline'])) {
            sleep($delaytime);
            printf('<script type="text/javascript">
          document.location = "./?page=pageaction&action=processqueue&ajaxed=true&reload=%d&lastsent=%d&lastskipped=%d%s";
        </script></body></html>', $reload, $counters['sent'], $notsent, addCsrfGetToken());
        }
    } elseif ($script_stage == 6 || $nothingtodo) {
        foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
            $plugin->messageQueueFinished();
        }
        processQueueOutput($GLOBALS['I18N']->get('Finished, All done'), 0);
        print '<script type="text/javascript">
      var parentJQuery = window.parent.jQuery;
      window.parent.allDone("' . s('All done') . '");
      </script>';
    } else {
        processQueueOutput(s('Script finished, but not all messages have been sent yet.'));
    }
    if (!empty($GLOBALS['inRemoteCall'])) {
        ob_end_clean();
        print outputCounters();
        @ob_start();
    }
    if (empty($GLOBALS['inRemoteCall']) && empty($GLOBALS['commandline']) && empty($_GET['ajaxed'])) {
        return;
    } elseif (!empty($GLOBALS['inRemoteCall']) || !empty($GLOBALS['commandline'])) {
        @ob_end_clean();
    }
    exit;
}
开发者ID:pedru,项目名称:phplist3,代码行数:87,代码来源:processqueue.php

示例13: put_lock

    //lock
    put_lock($connection, "googlockusers", "read");
    $temp = mysql_query($sql_query, $connection) or die("ss");
    remove_lock($connection);
    //unlock
    $no2 = mysql_fetch_array($temp);
    $no = mysql_real_escape_string($no2[completed]);
    //sessionno holds the next question no
    $no = $no + 1;
    $sql_query = "select answer from googlockquestions WHERE no='{$no}'";
    $temp = mysql_query($sql_query, $connection) or die("asdas");
    $corr_ans = mysql_fetch_array($temp);
    $corr_ans2 = strtolower($corr_ans[answer]);
    //echo "no: $no ;$corr_ans2 and $answer and $_POST[answer]";
    $corr_ans2 = explode(";", $corr_ans2);
    $counter = count($corr_ans2) - 1;
    for (; $counter >= 0; $counter -= 1) {
        if (strcmp($corr_ans2[$counter], $answer) == 0) {
            update($connection, $username);
            incrementscore($connection, $username);
            storetimestamp($connection, $username);
            break;
        }
    }
    finish($connection);
    if ($counter == -1) {
        header("Location:play.php?attempt=incorrect");
    } else {
        header("Location: play.php");
    }
}
开发者ID:Vidhan,项目名称:iFestSite,代码行数:31,代码来源:validate.php

示例14: Header

        die;
    }
    # is it a valid email?
    if (!$email || $email == "" || !eregi("^[_\\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,6}\$", $email) || strrpos($email, ' ') > 0) {
        $error = "Invalid email address!";
        Header("Location: init.php?error={$error}&uname={$uname}&fname={$fname}&lname={$lname}&email={$email}");
        die;
    }
    # is it a valid username?
    if (!$uname || $uname == "" || ereg("[^a-zA-Z0-9_-]", $uname) || is_numeric($uname[0])) {
        $error = "Invalid username!";
        Header("Location: init.php?error={$error}&uname={$uname}&fname={$fname}&lname={$lname}&email={$email}");
        die;
    }
    # cypher pwd
    $pwd = md5($pwd1);
    # set privs at 0 (root)
    $privs = 0;
    # insert into db
    sql_query("insert into jones_user values (NULL, '{$uname}', '{$pwd}', '{$fname}', '{$lname}', '{$email}', '{$privs}')", $dbi);
    sql_query("update jones_site set title='{$title}', sitename='{$sitename}', topname='{$topname}', logo='{$logo}', theme='{$theme}'", $dbi);
    Header("Location: index.php");
}
switch ($_GET["cmd"]) {
    case "finish":
        finish($_POST["uname"], $_POST["fname"], $_POST["lname"], $_POST["pwd1"], $_POST["pwd2"], $_POST["email"], $_POST["title"], $_POST["sitename"], $_POST["topname"], $_POST["logo"], $_POST["theme"]);
        break;
    default:
        main($_GET["error"], $_GET["uname"], $_GET["fname"], $_GET["lname"], $_GET["email"], $_GET["title"], $_GET["sitename"], $_GET["topname"], $_GET["logo"], $_GET["theme"]);
        break;
}
开发者ID:BackupTheBerlios,项目名称:jonescms,代码行数:31,代码来源:init.php

示例15: onRead

 /**
  * Called when new data received
  * @see http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10#page-16
  * @return void
  */
 public function onRead()
 {
     if ($this->state === self::STATE_PREHANDSHAKE) {
         if (!$this->handshake()) {
             return;
         }
     }
     if ($this->state === self::STATE_HANDSHAKED) {
         while (($buflen = $this->getInputLength()) >= 2) {
             $first = ord($this->look(1));
             // first byte integer (fin, opcode)
             $firstBits = decbin($first);
             $opcode = (int) bindec(substr($firstBits, 4, 4));
             if ($opcode === 0x8) {
                 // CLOSE
                 $this->finish();
                 return;
             }
             $opcodeName = isset(static::$opcodes[$opcode]) ? static::$opcodes[$opcode] : false;
             if (!$opcodeName) {
                 Daemon::log(get_class($this) . ': Undefined opcode ' . $opcode);
                 $this->finish();
                 return;
             }
             $second = ord($this->look(1, 1));
             // second byte integer (masked, payload length)
             $fin = (bool) ($first >> 7);
             $isMasked = (bool) ($second >> 7);
             $dataLength = $second & 0x7f;
             $p = 2;
             if ($dataLength === 0x7e) {
                 // 2 bytes-length
                 if ($buflen < $p + 2) {
                     return;
                     // not enough data yet
                 }
                 $dataLength = Binary::bytes2int($this->look(2, $p), false);
                 $p += 2;
             } elseif ($dataLength === 0x7f) {
                 // 8 bytes-length
                 if ($buflen < $p + 8) {
                     return;
                     // not enough data yet
                 }
                 $dataLength = Binary::bytes2int($this->look(8, $p));
                 $p += 8;
             }
             if ($this->pool->maxAllowedPacket <= $dataLength) {
                 // Too big packet
                 $this > finish();
                 return;
             }
             if ($isMasked) {
                 if ($buflen < $p + 4) {
                     return;
                     // not enough data yet
                 }
                 $mask = $this->look(4, $p);
                 $p += 4;
             }
             if ($buflen < $p + $dataLength) {
                 return;
                 // not enough data yet
             }
             $this->drain($p);
             $data = $this->read($dataLength);
             if ($isMasked) {
                 $data = $this->mask($data, $mask);
             }
             //Daemon::log(Debug::dump(array('ext' => $this->extensions, 'rsv1' => $firstBits[1], 'data' => Debug::exportBytes($data))));
             /*if ($firstBits[1] && in_array('deflate-frame', $this->extensions)) { // deflate frame
             			$data = gzuncompress($data, $this->pool->maxAllowedPacket);
             		}*/
             if (!$fin) {
                 $this->framebuf .= $data;
             } else {
                 $this->onFrame($this->framebuf . $data, $opcodeName);
                 $this->framebuf = '';
             }
         }
     }
 }
开发者ID:devypt,项目名称:phpdaemon,代码行数:87,代码来源:V13.php


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