Symfony\Component\HttpFoundation\Response::__toString PHP Méthode

__toString() public méthode

The string representation of the Response is the same as the one that will be sent to the client only if the prepare() method has been called before.
See also: prepare()
public __toString ( ) : string
Résultat string The Response as an HTTP string
    public function __toString()
    {
        return
            sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)."\r\n".
            $this->headers."\r\n".
            $this->getContent();
    }

Usage Example

Exemple #1
0
 public function __toString()
 {
     $this->headers->set('Content-Length', strlen($this->getContent()));
     return parent::__toString();
 }
All Usage Examples Of Symfony\Component\HttpFoundation\Response::__toString