Cli.php 503 B

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