Cli.php 574 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace Qii\Response;
  3. class Cli extends \Qii\Base\Response
  4. {
  5. public function __construct($body = null)
  6. {
  7. $this->body = $body;
  8. }
  9. /**
  10. * Magic __toString functionality
  11. *
  12. * @return string
  13. */
  14. public function __toString()
  15. {
  16. return $this->body;
  17. }
  18. /**
  19. * 在windows cmd 情况下的中文输出乱码问题
  20. * @param string $string
  21. * @return bool|int
  22. */
  23. public function stdout($string)
  24. {
  25. $string = iconv('utf-8', 'gbk', $string);
  26. fwrite(\STDOUT, $string);
  27. }
  28. }