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


PHP resource::write方法代码示例

本文整理汇总了PHP中resource::write方法的典型用法代码示例。如果您正苦于以下问题:PHP resource::write方法的具体用法?PHP resource::write怎么用?PHP resource::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在resource的用法示例。


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

示例1: send

 /**
  * Send the given string of data to the server.
  *
  * @param string $data The string of data to send.
  *
  * @return mixed The number of bytes that were actually written,
  *               or a PEAR_Error object on failure.
  *
  * @since 1.1.0
  */
 protected function send($data)
 {
     $this->debug("Send: {$data}");
     $result = $this->socket->write($data);
     if (!$result || PEAR::isError($result)) {
         $msg = $result ? $result->getMessage() : "unknown error";
         return PEAR::raiseError("Failed to write to socket: {$msg}");
     }
     return $result;
 }
开发者ID:alecpl,项目名称:Net_SMTP,代码行数:20,代码来源:SMTP.php

示例2:

 /**
  * Send the given string of data to the server.
  *
  * @param   string  $data       The string of data to send.
  *
  * @return  mixed   True on success or a PEAR_Error object on failure.
  *
  * @access  private
  * @since   1.1.0
  */
 function _send($data)
 {
     if ($this->_debug) {
         echo "DEBUG: Send: {$data}\n";
     }
     if (PEAR::isError($error = $this->_socket->write($data))) {
         return new PEAR_Error('Failed to write to socket: ' . $error->getMessage());
     }
     return true;
 }
开发者ID:bantudevelopment,项目名称:polysmis,代码行数:20,代码来源:SMTP.php

示例3: date

 /**
  * Send the given string of data to the server.
  *
  * @param   string  $data    The string of data to send.
  *
  * @return  mixed   True on success or a PEAR_Error object on failure.
  *
  * @access  private
  * @since  1.0
  */
 function _send($data)
 {
     if ($this->_socket->eof()) {
         return new PEAR_Error('Failed to write to socket: (connection lost!) ');
     }
     if (PEAR::isError($error = $this->_socket->write($data))) {
         return new PEAR_Error('Failed to write to socket: ' . $error->getMessage());
     }
     if ($this->_debug) {
         // C: means this data was sent by  the client (this class)
         echo "C: " . date("H:i:s") . " " . htmlspecialchars($data) . "\n";
         $this->dbgDialog .= "C: {$data}";
     }
     return true;
 }
开发者ID:drognisep,项目名称:Simple-Groupware,代码行数:25,代码来源:IMAPProtocol.php

示例4:

 /**
  * Send the given string of data to the server.
  *
  * @param string $data The string of data to send.
  *
  * @return mixed True on success or a PEAR_Error object on failure.
  *
  * @access private
  * @since 1.0
  */
 function _send($data)
 {
     if ($this->_socket->eof()) {
         return new PEAR_Error('Failed to write to socket: (connection lost!)');
     }
     if (PEAR::isError($error = $this->_socket->write($data))) {
         return new PEAR_Error('Failed to write to socket: ' . $error->getMessage());
     }
     if ($this->_debug) {
         // C: means this data was sent by  the client (this class)
         echo 'C: ' . $data;
         $this->dbgDialog .= 'C: ' . $data;
     }
     return true;
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:25,代码来源:IMAPProtocol.php

示例5: sessionCommit

 /**
  * Commmit session data
  * @param  callable $cb Callback
  * @return void
  */
 public function sessionCommit($cb = null)
 {
     if (!$this->sessionFp || $this->sessionFlushing) {
         if ($cb) {
             call_user_func($cb, false);
         }
         return;
     }
     $this->sessionFlushing = true;
     $data = $this->sessionEncode();
     $l = strlen($data);
     $cb = CallbackWrapper::wrap($cb);
     $this->sessionFp->write($data, function ($file, $result) use($l, $cb) {
         $file->truncate($l, function ($file, $result) use($cb) {
             $this->sessionFlushing = false;
             if ($cb) {
                 call_user_func($cb, true);
             }
         });
     });
 }
开发者ID:shamahan,项目名称:phpdaemon,代码行数:26,代码来源:Sessions.php

示例6: identifySender

 /**
  * Attempt to send the EHLO command and obtain a list of ESMTP
  * extensions available, and failing that just send HELO.
  *
  * @return mixed Returns a PEAR_Error with an error message on any
  *               kind of failure, or true on success.
  * @access private
  */
 function identifySender()
 {
     if (PEAR::isError($this->socket->write("EHLO {$this->localhost}\r\n"))) {
         return new PEAR_Error('write to socket failed');
     }
     $extensions = array();
     if (!$this->validateAndParseResponse('250', $extensions)) {
         if (PEAR::isError($this->socket->write("HELO {$this->localhost}\r\n"))) {
             return new PEAR_Error('write to socket failed');
         }
         if (!$this->validateResponse('250')) {
             return new PEAR_Error('HELO not accepted', $this->code);
         }
         return true;
     }
     for ($i = 0; $i < count($extensions); $i++) {
         $verb = strtok($extensions[$i], ' ');
         $arguments = substr($extensions[$i], strlen($verb) + 1, strlen($extensions[$i]) - strlen($verb) - 2);
         $this->esmtp[$verb] = $arguments;
     }
     return true;
 }
开发者ID:laiello,项目名称:coopcrucial,代码行数:30,代码来源:SMTP.php

示例7:

 /**
  * Sends a command to the server
  *
  * @param string $cmd The command to send.
  *
  * @return void
  */
 function _sendCmd($cmd)
 {
     $status = $this->_sock->getStatus();
     if (is_a($status, 'PEAR_Error') || $status['eof']) {
         return $this->_pear->raiseError('Failed to write to socket: connection lost');
     }
     $error = $this->_sock->write($cmd . "\r\n");
     if (is_a($error, 'PEAR_Error')) {
         return $this->_pear->raiseError('Failed to write to socket: ' . $error->getMessage());
     }
     $this->_debug("C: {$cmd}");
 }
开发者ID:FrancisRussell,项目名称:Net_Sieve,代码行数:19,代码来源:Sieve.php

示例8:

 /**
  * Send the given string of data to the server.
  *
  * @param   string  $data       The string of data to send.
  *
  * @return  mixed   The number of bytes that were actually written,
  *                  or a PEAR_Error object on failure.
  *
  * @access  private
  * @since   1.1.0
  */
 function _send($data)
 {
     $this->_debug("Send: {$data}");
     $result = $this->_socket->write($data);
     if (!$result || PEAR::isError($result)) {
         $msg = $result ? $result->getMessage() : "unknown error";
         return PEAR::raiseError("Failed to write to socket: {$msg}", null, PEAR_ERROR_RETURN);
     }
     return $result;
 }
开发者ID:rbraband,项目名称:sefrengo,代码行数:21,代码来源:SMTP.php

示例9: _send

 /**
  * Send the given string of data to the server.
  *
  * @param string $data  The string of data to send.
  *
  * @return integer  The number of bytes that were actually written.
  * @throws PEAR_Exception
  */
 protected function _send($data)
 {
     $this->_debug("Send: {$data}");
     $result = $this->_socket->write($data);
     if ($result === false) {
         return Net_SMTP::raiseError('Failed to write to socket: ' . $result->getMessage(), $result);
     }
     return $result;
 }
开发者ID:alanturing1,项目名称:Z-Push-contrib,代码行数:17,代码来源:SMTP.php

示例10:

 /**
  * Sends a command to the server
  *
  * @param string $cmd The command to send.
  *
  * @return void
  */
 function _sendCmd($cmd)
 {
     $status = $this->_sock->getStatus();
     if (PEAR::isError($status) || $status['eof']) {
         return PEAR::raiseError('Failed to write to socket: connection lost');
     }
     if (PEAR::isError($error = $this->_sock->write($cmd . "\r\n"))) {
         return PEAR::raiseError('Failed to write to socket: ' . $error->getMessage());
     }
     $this->_debug("C: {$cmd}");
 }
开发者ID:cjvaz,项目名称:expressomail,代码行数:18,代码来源:Sieve.php

示例11: PEAR

 /**
  * Send the given string of data to the server.
  *
  * @param   string  $data       The string of data to send.
  *
  * @return  mixed   The number of bytes that were actually written,
  *                  or a PEAR_Error object on failure.
  *
  * @access  private
  * @since   1.1.0
  */
 function _send($data)
 {
     $this->_debug("Send: {$data}");
     $result = $this->_socket->write($data);
     if (!$result || PEAR::isError($result)) {
         $msg = $result ? $result->getMessage() : "unknown error";
         $p = new PEAR();
         return $p->raiseError("Failed to write to socket: {$msg}", null, PEAR_ERROR_RETURN);
     }
     // we have to set timeout, so it works..
     //$this->setTimeout($this->_timeout);
     return $result;
 }
开发者ID:roojs,项目名称:pear,代码行数:24,代码来源:SMTP.php

示例12:

 /**
  * Send the given string of data to the server.
  *
  * @param   string  $data       The string of data to send.
  *
  * @return  mixed   True on success or a PEAR_Error object on failure.
  *
  * @access  private
  * @since   1.1.0
  */
 function _send($data)
 {
     $this->_debug("Send: {$data}");
     if (PEAR::isError($error = $this->_socket->write($data))) {
         return PEAR::raiseError('Failed to write to socket: ' . $error->getMessage());
     }
     return true;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:18,代码来源:SMTP.php

示例13:

 /**
  * Private method for sending data to SMTP connection
  *
  * @param string $data data to be sent to SMTP server
  * @param mixed $checkCode code to check for in server response, false to skip
  * @return bool Success
  * @access private
  */
 function __smtpSend($data, $checkCode = '250')
 {
     if (!is_null($data)) {
         $this->__smtpConnection->write($data . "\r\n");
     }
     if ($checkCode !== false) {
         $response = $this->__smtpConnection->read();
         if (!preg_match('/^' . $checkCode . '/', $response)) {
             $this->smtpError = $response;
             return false;
         }
     }
     return true;
 }
开发者ID:subh,项目名称:raleigh-workshop-08,代码行数:22,代码来源:email.php

示例14:

 /**
  * Send the given string of data to the server.
  *
  * @param   string  $data       The string of data to send.
  *
  * @return  mixed   True on success or a PEAR_Error object on failure.
  *
  * @access  private
  * @since   1.1.0
  */
 function _send($data)
 {
     $this->_debug("Send: {$data}");
     $error = $this->_socket->write($data);
     if ($error === false || PEAR::isError($error)) {
         $msg = $error ? $error->getMessage() : "unknown error";
         return PEAR::raiseError("Failed to write to socket: {$msg}");
     }
     return true;
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:20,代码来源:SMTP.php

示例15: _send

 /**
  * Send the given string of data to the server.
  *
  * @param   string  $data	   The string of data to send.
  *
  * @return  mixed   True on success or a PEAR_Error object on failure.
  *
  * @access  private
  * @since   1.1.0
  */
 private function _send($data)
 {
     if ($this->_debug) {
         echo "DEBUG: Send: {$data}\n";
     }
     if (Error::is_error($error = $this->_socket->write($data))) {
         throw Error::raise('Failed to write to socket: ' . $error->getMessage());
     }
     return true;
 }
开发者ID:habari-extras,项目名称:mail_smtp,代码行数:20,代码来源:mail.php


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