/** * @return int */ public function get() { if ($this->serverDown) { list($usec, $sec) = explode(" ", microtime()); $time_ms = $sec * 1000 + $usec / 1000; $count = rand(0, 16383); $gpid = 0; // php生产的uuid特有的标记 return $time_ms << 22 | $count << 9 | $gpid; } $msg = Core_Helper_Net_Http::buildRequest('/', '', 'GET'); $this->tcp->send($msg); $header = Core_Helper_Net_Http::readHeader($this->tcp); $body = Core_Helper_Net_Http::readBody($this->tcp, $header, $this->errno, $this->errstr); return (int) trim($body); }