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


PHP resource::readLine方法代码示例

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


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

示例1: array

    /**
     * Read a reply from the SMTP server.  The reply consists of a response
     * code and a response message.
     *
     * @param   mixed   $valid      The set of valid response codes.  These
     *                              may be specified as an array of integer
     *                              values or as a single integer value.
     *
     * @return  mixed   True if the server returned a valid response code or
     *                  a PEAR_Error object is an error condition is reached.
     *
     * @access  private
     * @since   1.1.0
     *
     * @see     getResponse
     */
    function _parseResponse($valid)
    {
        $this->_code = -1;
        $this->_arguments = array();

        while ($line = $this->_socket->readLine()) {
            if ($this->_debug) {
                echo "DEBUG: Recv: $line\n";
            }

            /* If we receive an empty line, the connection has been closed. */
            if (empty($line)) {
                $this->disconnect();
                return PEAR::raiseError('Connection was unexpectedly closed');
            }

            /* Read the code and store the rest in the arguments array. */
            $code = substr($line, 0, 3);
            $this->_arguments[] = trim(substr($line, 4));

            /* Check the syntax of the response code. */
            if (is_numeric($code)) {
                $this->_code = (int)$code;
            } else {
                $this->_code = -1;
                break;
            }

            /* If this is not a multiline response, we're done. */
            if (substr($line, 3, 1) != '-') {
                break;
            }
        }

        /* Compare the server's response code with the valid code. */
        if (is_int($valid) && ($this->_code === $valid)) {
            return true;
        }

        /* If we were given an array of valid response codes, check each one. */
        if (is_array($valid)) {
            foreach ($valid as $valid_code) {
                if ($this->_code === $valid_code) {
                    return true;
                }
            }
        }

        return PEAR::raiseError('Invalid response code received from server',
                                $this->_code);
    }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:67,代码来源:SMTP.php

示例2: validateAndParseResponse

 /**
  * Read a response from the server and see if the response code
  * matches what we are expecting. Also save the rest of the
  * response in the array passed by reference as the second
  * argument.
  *
  * @param int The response code we are expecting.
  * @param array An array to dump the rest of the response into.
  *
  * @return boolean True if we get what we expect, false otherwise.
  * @access private
  */
 function validateAndParseResponse($code, &$arguments)
 {
     $arguments = array();
     while ($this->lastline = $this->socket->readLine()) {
         $reply_code = strtok($this->lastline, ' ');
         if (!strcmp($code, $reply_code)) {
             $arguments[] = substr($this->lastline, strlen($code) + 1, strlen($this->lastline) - strlen($code) - 1);
             $this->code = $reply_code;
             return true;
         } else {
             $reply_code = strtok($this->lastline, '-');
             if (strcmp($code, $reply_code)) {
                 $this->code = $reply_code;
                 return false;
             }
         }
         $arguments[] = substr($this->lastline, strlen($code) + 1, strlen($this->lastline) - strlen($code) - 1);
     }
     return false;
 }
开发者ID:laiello,项目名称:coopcrucial,代码行数:32,代码来源:SMTP.php

示例3: parseResponse

 /**
  * Read a reply from the SMTP server.  The reply consists of a response
  * code and a response message.
  *
  * @param mixed $valid The set of valid response codes.  These
  *                     may be specified as an array of integer
  *                     values or as a single integer value.
  * @param bool  $later Do not parse the response now, but wait
  *                     until the last command in the pipelined
  *                     command group
  *
  * @return mixed True if the server returned a valid response code or
  *               a PEAR_Error object is an error condition is reached.
  *
  * @since 1.1.0
  *
  * @see getResponse
  */
 protected function parseResponse($valid, $later = false)
 {
     $this->code = -1;
     $this->arguments = array();
     if ($later) {
         $this->pipelined_commands++;
         return true;
     }
     for ($i = 0; $i <= $this->pipelined_commands; $i++) {
         while ($line = $this->socket->readLine()) {
             $this->debug("Recv: {$line}");
             /* If we receive an empty line, the connection was closed. */
             if (empty($line)) {
                 $this->disconnect();
                 return PEAR::raiseError('Connection was closed');
             }
             /* Read the code and store the rest in the arguments array. */
             $code = substr($line, 0, 3);
             $this->arguments[] = trim(substr($line, 4));
             /* Check the syntax of the response code. */
             if (is_numeric($code)) {
                 $this->code = (int) $code;
             } else {
                 $this->code = -1;
                 break;
             }
             /* If this is not a multiline response, we're done. */
             if (substr($line, 3, 1) != '-') {
                 break;
             }
         }
     }
     $this->pipelined_commands = 0;
     /* Compare the server's response code with the valid code/codes. */
     if (is_int($valid) && $this->code === $valid) {
         return true;
     } elseif (is_array($valid) && in_array($this->code, $valid, true)) {
         return true;
     }
     return PEAR::raiseError('Invalid response code received from server', $this->code);
 }
开发者ID:alecpl,项目名称:Net_SMTP,代码行数:59,代码来源:SMTP.php

示例4: array

 /**
  * Read a reply from the SMTP server.  The reply consists of a response
  * code and a response message.
  *
  * @param   mixed   $valid      The set of valid response codes.  These
  *                              may be specified as an array of integer
  *                              values or as a single integer value.
  * @param   bool    $later      Do not parse the response now, but wait
  *                              until the last command in the pipelined
  *                              command group
  *
  * @return  mixed   True if the server returned a valid response code or
  *                  a PEAR_Error object is an error condition is reached.
  *
  * @access  private
  * @since   1.1.0
  *
  * @see     getResponse
  */
 function _parseResponse($valid, $later = false)
 {
     $this->_code = -1;
     $this->_arguments = array();
     if ($later) {
         $this->_pipelined_commands++;
         return true;
     }
     for ($i = 0; $i <= $this->_pipelined_commands; $i++) {
         while ($line = $this->_socket->readLine()) {
             $this->_debug("Recv: {$line}");
             /* If we receive an empty line, the connection was closed. */
             if (empty($line)) {
                 $this->disconnect();
                 return PEAR::raiseError('Connection was closed', null, PEAR_ERROR_RETURN);
             }
             /* Read the code and store the rest in the arguments array. */
             $code = substr($line, 0, 3);
             $this->_arguments[] = trim(substr($line, 4));
             /* Check the syntax of the response code. */
             if (is_numeric($code)) {
                 $this->_code = (int) $code;
             } else {
                 $this->_code = -1;
                 break;
             }
             /* If this is not a multiline response, we're done. */
             if (substr($line, 3, 1) != '-') {
                 break;
             }
         }
     }
     $this->_pipelined_commands = 0;
     /* Compare the server's response code with the valid code/codes. */
     if (is_int($valid) && $this->_code === $valid) {
         return true;
     } elseif (is_array($valid) && in_array($this->_code, $valid, true)) {
         return true;
     }
     // CRM-8744
     $errorMessage = 'Invalid response code received from SMTP server while sending email.  This is often caused by a misconfiguration in Outbound Email settings. Please verify the settings at Administer CiviCRM >> Global Settings >> Outbound Email (SMTP).';
     return PEAR::raiseError($errorMessage, $this->_code, PEAR_ERROR_RETURN);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:62,代码来源:SMTP.php

示例5: array

 /**
  * Read a reply from the SMTP server.  The reply consists of a response
  * code and a response message.
  *
  * @param   mixed   $valid      The set of valid response codes.  These
  *                              may be specified as an array of integer
  *                              values or as a single integer value.
  * @param   bool    $later      Do not parse the response now, but wait
  *                              until the last command in the pipelined
  *                              command group
  *
  * @return  mixed   True if the server returned a valid response code or
  *                  a PEAR_Error object is an error condition is reached.
  *
  * @access  private
  * @since   1.1.0
  *
  * @see     getResponse
  */
 function _parseResponse($valid, $later = false)
 {
     $this->_code = -1;
     $this->_arguments = array();
     if ($later) {
         $this->_pipelined_commands++;
         return true;
     }
     for ($i = 0; $i <= $this->_pipelined_commands; $i++) {
         while ($line = $this->_socket->readLine()) {
             $this->_debug("Recv: {$line}");
             /* If we receive an empty line, the connection has been closed. */
             if (empty($line)) {
                 $this->disconnect();
                 return PEAR::raiseError('Connection was unexpectedly closed');
             }
             /* Read the code and store the rest in the arguments array. */
             $code = substr($line, 0, 3);
             $this->_arguments[] = trim(substr($line, 4));
             /* Check the syntax of the response code. */
             if (is_numeric($code)) {
                 $this->_code = (int) $code;
             } else {
                 $this->_code = -1;
                 break;
             }
             /* If this is not a multiline response, we're done. */
             if (substr($line, 3, 1) != '-') {
                 break;
             }
         }
     }
     $this->_pipelined_commands = 0;
     /* Server response code 553 => Requested action not taken-Mailbox name invalid.
      * Server response code 503 => Bad sequence of commands.
      */
     if ($this->_code == 553 || $this->_code == 503 || $this->_code == 501) {
         return PEAR::raiseError('recipient is not recognized');
     }
     /* Compare the server's response code with the valid code/codes. */
     if (is_int($valid) && $this->_code === $valid) {
         return true;
     } elseif (is_array($valid) && in_array($this->_code, $valid, true)) {
         return true;
     }
     /* 535: Authentication failed */
     if ($this->_code == 535) {
         $this->disconnect();
         return PEAR::raiseError('Authentication failed.');
     }
     $errorMessage = 'Invalid response code received from SMTP (outbound mail) server while attempting to send email.  This is often caused by a misconfiguration in the CiviCRM Outbound Email settings. Please verify the settings at Administer CiviCRM >> Global Settings >> Outbound Email (SMTP).';
     return PEAR::raiseError($errorMessage);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:72,代码来源:SMTP.php


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