當前位置: 首頁>>代碼示例>>PHP>>正文


PHP self::setBody方法代碼示例

本文整理匯總了PHP中self::setBody方法的典型用法代碼示例。如果您正苦於以下問題:PHP self::setBody方法的具體用法?PHP self::setBody怎麽用?PHP self::setBody使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在self的用法示例。


在下文中一共展示了self::setBody方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: create

 /**
  * Creates constraint object from tokens.
  * <p>
  * If parameter $constraintName is not passed then current position should point to the name of the constraint.
  *
  * @param Tokenizer $tokenizer Tokens collection.
  * @param string $constraintName Optional name of the constraint.
  *
  * @return Constraint
  */
 public static function create(Tokenizer $tokenizer, $constraintName = '')
 {
     if ($constraintName === false) {
         $constraintName = '';
     } elseif (!$constraintName) {
         $constraintName = $tokenizer->getCurrentToken()->text;
         $tokenizer->nextToken();
         $tokenizer->skipWhiteSpace();
     }
     $constraint = new self($constraintName);
     $token = $tokenizer->getCurrentToken();
     $level = $token->level;
     $constraintDefinition = '';
     do {
         if ($token->level == $level && $token->text == ',') {
             break;
         }
         if ($token->level < $level && $token->text == ')') {
             break;
         }
         $constraintDefinition .= $token->text;
         $token = $tokenizer->nextToken();
     } while (!$tokenizer->endOfInput());
     $constraint->setBody($constraintDefinition);
     return $constraint;
 }
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:36,代碼來源:constraint.php

示例2: fromReflection

 public static function fromReflection(Zend_Reflection_Method $reflectionMethod)
 {
     $method = new self();
     $method->setSourceContent($reflectionMethod->getContents(false));
     $method->setSourceDirty(false);
     if ($reflectionMethod->getDocComment() != '') {
         $method->setDocblock(Zend_CodeGenerator_Php_Docblock::fromReflection($reflectionMethod->getDocblock()));
     }
     $method->setFinal($reflectionMethod->isFinal());
     if ($reflectionMethod->isPrivate()) {
         $method->setVisibility(self::VISIBILITY_PRIVATE);
     } elseif ($reflectionMethod->isProtected()) {
         $method->setVisibility(self::VISIBILITY_PROTECTED);
     } else {
         $method->setVisibility(self::VISIBILITY_PUBLIC);
     }
     $method->setStatic($reflectionMethod->isStatic());
     $method->setName($reflectionMethod->getName());
     foreach ($reflectionMethod->getParameters() as $reflectionParameter) {
         $method->setParameter(Zend_CodeGenerator_Php_Parameter::fromReflection($reflectionParameter));
     }
     $body = $reflectionMethod->getBody();
     $body2 = str_replace("\n\n", "\n", $body);
     $body2 = preg_replace("|^\n\\s{4}|muU", "\n", $body2);
     $body2 = preg_replace("|^\\s{4}|muU", "", $body2);
     //    $body2 = str_replace(' ', '.', $body2);
     //dmDebug::kill($body, "\n".$body2);
     $method->setBody($body2);
     return $method;
 }
開發者ID:theolymp,項目名稱:diem,代碼行數:30,代碼來源:Method.php

示例3: fromRaw

 public static function fromRaw($body, $headers)
 {
     $out = new self();
     $out->setBody($body);
     $out->setHeaders($headers);
     $out->parseData();
     return $out;
 }
開發者ID:catlabinteractive,項目名稱:neuron,代碼行數:8,代碼來源:Response.php

示例4: post

 /**
  * @param string $url
  * @param array $post
  * @param wfWAFHTTP $request
  * @return wfWAFHTTPResponse|bool
  * @throws wfWAFHTTPTransportException
  */
 public static function post($url, $post = array(), $request = null)
 {
     if (!$request) {
         $request = new self();
     }
     $request->setUrl($url);
     $request->setMethod('POST');
     $request->setBody($post);
     $request->setTransport(wfWAFHTTPTransport::getInstance());
     return $request->send();
 }
開發者ID:ashenkar,項目名稱:sanga,代碼行數:18,代碼來源:http.php

示例5: create

 /**
  * Creates trigger object from tokens.
  * <p>
  * Current position should point to the name of the trigger.
  *
  * @param Tokenizer $tokenizer Tokens collection.
  *
  * @return Trigger
  */
 public static function create(Tokenizer $tokenizer)
 {
     $name = $tokenizer->getCurrentToken()->text;
     $trigger = new self($name);
     $tokenizer->resetState();
     $definition = '';
     while (!$tokenizer->endOfInput()) {
         $definition .= $tokenizer->getCurrentToken()->text;
         $tokenizer->nextToken();
     }
     $trigger->setBody($definition);
     return $trigger;
 }
開發者ID:Satariall,項目名稱:izurit,代碼行數:22,代碼來源:trigger.php

示例6: fromReflection

 /**
  * Enter description here...
  *
  * @param ZendL_Reflection_File $reflectionFile
  * @return ZendL_Tool_CodeGenerator_Php_File
  */
 public static function fromReflection(ZendL_Reflection_File $reflectionFile)
 {
     $file = new self();
     $file->setSourceContent($reflectionFile->getContents());
     $file->setSourceDirty(false);
     $body = $reflectionFile->getContents();
     // @todo this whole area needs to be reworked with respect to how body lines are processed
     foreach ($reflectionFile->getClasses() as $class) {
         $file->setClass(ZendL_Tool_CodeGenerator_Php_Class::fromReflection($class));
         $classStartLine = $class->getStartLine(true);
         $classEndLine = $class->getEndLine();
         $bodyLines = explode("\n", $body);
         $bodyReturn = array();
         for ($lineNum = 1; $lineNum <= count($bodyLines); $lineNum++) {
             if ($lineNum == $classStartLine) {
                 $bodyReturn[] = str_replace('?', $class->getName(), self::$_markerClass);
                 //'/* ZendL_Tool_CodeGenerator_Php_File-ClassMarker: {' . $class->getName() . '} */';
                 $lineNum = $classEndLine;
             } else {
                 $bodyReturn[] = $bodyLines[$lineNum - 1];
                 // adjust for index -> line conversion
             }
         }
         $body = implode("\n", $bodyReturn);
         unset($bodyLines, $bodyReturn, $classStartLine, $classEndLine);
     }
     if ($docblock = $reflectionFile->getDocblock()) {
         $file->setDocblock(ZendL_Tool_CodeGenerator_Php_Docblock::fromReflection($docblock));
         $bodyLines = explode("\n", $body);
         $bodyReturn = array();
         for ($lineNum = 1; $lineNum <= count($bodyLines); $lineNum++) {
             if ($lineNum == $docblock->getStartLine()) {
                 $bodyReturn[] = str_replace('?', $class->getName(), self::$_markerDocblock);
                 //'/* ZendL_Tool_CodeGenerator_Php_File-ClassMarker: {' . $class->getName() . '} */';
                 $lineNum = $docblock->getEndLine();
             } else {
                 $bodyReturn[] = $bodyLines[$lineNum - 1];
                 // adjust for index -> line conversion
             }
         }
         $body = implode("\n", $bodyReturn);
         unset($bodyLines, $bodyReturn, $classStartLine, $classEndLine);
     }
     $file->setBody($body);
     return $file;
 }
開發者ID:lortnus,項目名稱:zf1,代碼行數:52,代碼來源:File.php

示例7: SpSendMail

 /**
  * @param array $recipient Recipient e-mail address
  * @param string $subject E-mail subject
  * @param string $body Message body
  * @param bool $html - HTML mail or plain text
  * @param array $replyto Reply to email address
  * @param array $cc CC e-mail address
  * @param array $bcc BCC e-mail address
  * @param string $attachment Attachment file name
  * @param array $cert - pem certificate
  * @param array $from - array( from, fromname )
  * @internal param array $replytoname Reply to name
  * @return boolean True on success
  */
 public static function SpSendMail($recipient, $subject, $body, $html = false, $replyto = null, $cc = null, $bcc = null, $attachment = null, $cert = null, $from = null)
 {
     $from = is_array($from) ? $from : array(Sobi::Cfg('mail.from'), Sobi::Cfg('mail.fromname'));
     $mail = new self();
     $mail->setSender($from);
     $mail->setSubject($subject);
     $mail->setBody($body);
     if ($html) {
         $mail->IsHTML(true);
     }
     if ($cert) {
         $mail->Sign($cert['certificate'], $cert['key'], $cert['password']);
     }
     $mail->addRecipient($recipient);
     $mail->addCC($cc);
     $mail->addBCC($bcc);
     $mail->addAttachment($attachment);
     $mail->addReplyTo($replyto);
     return $mail->Send();
 }
開發者ID:kishoreweblabs,項目名稱:SobiPro,代碼行數:34,代碼來源:mail.php

示例8: create

 /**
  * Creates stored procedure object from tokens.
  * <p>
  * Current position should point to the type of the stored procedure (PROCEDURE, FUNCTION or TYPE).
  * <p>
  * Name may consist of two parts divided by '.'.
  *
  * @param Tokenizer $tokenizer Tokens collection.
  *
  * @return Procedure
  */
 public static function create(Tokenizer $tokenizer)
 {
     $type = $tokenizer->getCurrentToken()->text;
     $tokenizer->nextToken();
     $tokenizer->skipWhiteSpace();
     $name = $tokenizer->getCurrentToken()->text;
     $token = $tokenizer->nextToken();
     if ($token->text === '.') {
         $token = $tokenizer->nextToken();
         $name .= '.' . $token->text;
     }
     $procedure = new self($name, $type);
     $tokenizer->resetState();
     $definition = '';
     while (!$tokenizer->endOfInput()) {
         $definition .= $tokenizer->getCurrentToken()->text;
         $tokenizer->nextToken();
     }
     $procedure->setBody($definition);
     return $procedure;
 }
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:32,代碼來源:procedure.php

示例9: fromInput

 /**
  * @return Request
  */
 public static function fromInput()
 {
     global $module;
     $model = new self();
     $model->setMethod(self::getMethodFromInput());
     if (isset($module)) {
         $model->setPath($module);
         $input = explode('/', $module);
         $model->setSegments($input);
     }
     $model->setBody(InputStream::getInput());
     $model->setHeaders(self::getHeadersFromInput());
     $model->setParameters($_GET);
     $model->setCookies($_COOKIE);
     $model->setPost($_POST);
     $model->setEnvironment($_SERVER);
     $model->setStatus(http_response_code());
     $model->setUrl(self::getCurrentUri());
     $model->parseData();
     return $model;
 }
開發者ID:catlabinteractive,項目名稱:neuron,代碼行數:24,代碼來源:Request.php

示例10: createFromRawResponse

 /**
  */
 public static function createFromRawResponse($rawResponse)
 {
     $response = new self($rawResponse);
     $lines = preg_split('/(\\r?\\n)/', $rawResponse);
     for ($i = 0; $i < count($lines); $i++) {
         if (0 == $i) {
             preg_match('/^HTTP\\/(\\d\\.\\d)\\s(\\d+)\\s(.+)/', $lines[$i], $statusLine);
             $response->setStatusCode($statusCode = $statusLine[2]);
             continue;
         }
         if (empty($lines[$i])) {
             $body = array_slice($lines, $i + 1);
             $response->setBody(implode("\n", $body));
             break;
         }
         if (strpos($lines[$i], ':')) {
             $headerParts = explode(':', $lines[$i]);
             $response->setHeader($headerParts[0], $headerParts[1]);
         }
     }
     return $response;
 }
開發者ID:basedontruestory,項目名稱:php-bitpay-client,代碼行數:24,代碼來源:Response.php

示例11: fromReflection

 /**
  * fromReflection()
  *
  * @param Zend_Reflection_Method $reflectionMethod
  * @return Zend_CodeGenerator_Php_Method
  */
 public static function fromReflection(Zend_Reflection_Method $reflectionMethod)
 {
     $method = new self();
     $method->setSourceContent($reflectionMethod->getContents(false));
     $method->setSourceDirty(false);
     if ($reflectionMethod->getDocComment() != '') {
         $method->setDocblock(Zend_CodeGenerator_Php_Docblock::fromReflection($reflectionMethod->getDocblock()));
     }
     $method->setFinal($reflectionMethod->isFinal());
     if ($reflectionMethod->isPrivate()) {
         $method->setVisibility(self::VISIBILITY_PRIVATE);
     } elseif ($reflectionMethod->isProtected()) {
         $method->setVisibility(self::VISIBILITY_PROTECTED);
     } else {
         $method->setVisibility(self::VISIBILITY_PUBLIC);
     }
     $method->setStatic($reflectionMethod->isStatic());
     $method->setName($reflectionMethod->getName());
     foreach ($reflectionMethod->getParameters() as $reflectionParameter) {
         $method->setParameter(Zend_CodeGenerator_Php_Parameter::fromReflection($reflectionParameter));
     }
     $method->setBody($reflectionMethod->getBody());
     return $method;
 }
開發者ID:Cryde,項目名稱:sydney-core,代碼行數:30,代碼來源:Method.php

示例12: sendMailS

 public static function sendMailS($sender, $receiver, $subject, $body, $html = false, $resendCheck = false)
 {
     $mail = new self();
     $mail->setSender($sender);
     $mail->setReceiver($receiver);
     $mail->setSubject($subject);
     $mail->setBody($body);
     $mail->setResendCheck($resendCheck);
     return false === $html ? $mail->sendAsText() : $mail->sendAsHTML();
 }
開發者ID:sinfocol,項目名稱:gwf3,代碼行數:10,代碼來源:GWF_Mail.php

示例13: fromString

 /**
  * Create an instance from an input string.
  * @param  string     $str the stringified response
  * @return \vakata\http\Response          the response instance
  * @codeCoverageIgnore
  */
 public static function fromString($str)
 {
     $res = new self();
     $break = strpos($str, "\r\n\r\n") === false ? "\n" : "\r\n";
     // just in case someone breaks RFC 2616
     list($headers, $message) = explode($break . $break, (string) $str, 2);
     $headers = explode($break, preg_replace("(" . $break . "\\s+)", " ", $headers));
     if (isset($headers[0]) && substr($headers[0], 0, 5) === 'HTTP/') {
         $temp = explode(' ', substr($headers[0], 5));
         $res->setProtocolVersion($temp[0]);
         $res->setStatusCode((int) $temp[1]);
         unset($headers[0]);
         $headers = array_values($headers);
     }
     foreach (array_filter($headers) as $v) {
         $v = explode(':', $v, 2);
         $res->setHeader(trim($v[0]), trim($v[1]));
     }
     $res->setBody($message);
     $res->removeHeader('Content-Length');
     $res->removeHeader('Transfer-Encoding');
     return $res;
 }
開發者ID:vakata,項目名稱:http,代碼行數:29,代碼來源:Response.php

示例14: fromString

 /**
  * Create an instance from a stringified request.
  * @param  string     $str the stringified request
  * @return \vakata\http\Request          the request instance
  * @codeCoverageIgnore
  */
 public static function fromString($str)
 {
     $req = new self();
     $break = strpos($str, "\r\n\r\n") === false ? "\n" : "\r\n";
     // just in case someone breaks RFC 2616
     list($headers, $message) = explode($break . $break, $str, 2);
     $headers = explode($break, preg_replace("(" . $break . "\\s+)", " ", $headers));
     if (isset($headers[0]) && strlen($headers[0])) {
         $temp = explode(' ', $headers[0]);
         if (in_array($temp[0], ['GET', 'POST', 'HEAD', 'PATCH', 'PUT', 'OPTIONS', 'TRACE', 'DELETE'])) {
             $req->setMethod($temp[0]);
             $req->setUrl($temp[1]);
             if (isset($temp[2])) {
                 $req->setProtocolVersion(substr($temp[2], 5));
             }
             unset($headers[0]);
             $headers = array_values($headers);
         }
     }
     foreach (array_filter($headers) as $v) {
         $v = explode(':', $v, 2);
         $req->setHeader(trim($v[0]), trim($v[1]));
     }
     if ($req->hasHeader('Host')) {
         $host = explode(':', $req->getHeader('Host'), 2);
         $req->getUrl()->setHost($host[0]);
         if (isset($host[1]) && (int) $host[1]) {
             $req->getUrl()->setPort($host[1]);
         }
     }
     if (strpos($req->getHeader('Content-Type'), 'multipart') !== false) {
         $bndr = trim(explode(' boundary=', $req->getHeader('Content-Type'))[1], '"');
         $parts = explode($break . '--' . $bndr, $break . $message);
         array_pop($parts);
         array_shift($parts);
         $post = [];
         foreach ($parts as $item) {
             list($head, $body) = explode($break . $break, $item, 2);
             $head = explode($break, preg_replace("(" . $break . "\\s+)", " ", $head));
             foreach ($head as $h) {
                 if (strpos(strtolower($h), 'content-disposition') === 0) {
                     $cd = explode(';', $h);
                     $name = '';
                     $file = '';
                     foreach ($cd as $p) {
                         if (strpos(trim($p), 'name=') === 0) {
                             $name = trim(explode('name=', $p)[1], ' "');
                         }
                         if (strpos(trim($p), 'filename=') === 0) {
                             $file = trim(explode('filename=', $p)[1], ' "');
                         }
                     }
                     if ($file) {
                         $req->addUpload($name, $body, $file);
                     } else {
                         $post[$name] = $body;
                     }
                 }
             }
         }
         $req->setBody(http_build_query($post));
     } elseif (strlen($message)) {
         $req->setBody($message);
     }
     $req->removeHeader('Content-Length');
     $req->removeHeader('Transfer-Encoding');
     return $req;
 }
開發者ID:vakata,項目名稱:http,代碼行數:74,代碼來源:Request.php

示例15: send

 static function send($to, $subject, $msg, $attach = '', $attachFilename = '')
 {
     $e = new self();
     $e->setFrom(ini::get('email-address'), ini::get('email-name'));
     $e->setTo($to);
     $e->setSubject($subject);
     $e->setBody($msg);
     if (strlen($attach)) {
         $e->attach($attach, strlen($attachFilename) ? $attachFilename : 'attachment-1');
     }
     return $e->mail();
 }
開發者ID:NatWeiss,項目名稱:JankyPHP,代碼行數:12,代碼來源:email.php


注:本文中的self::setBody方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。