yii\console\Controller::stdout PHP Method

stdout() public method

You may optionally format the string with ANSI codes by passing additional parameters using the constants defined in [[\yii\helpers\Console]]. Example: $this->stdout('This will be red and underlined.', Console::FG_RED, Console::UNDERLINE);
public stdout ( string $string ) : integer | boolean
$string string the string to print
return integer | boolean Number of bytes printed or false on error
    public function stdout($string)
    {
        if ($this->isColorEnabled()) {
            $args = func_get_args();
            array_shift($args);
            $string = Console::ansiFormat($string, $args);
        }
        return Console::stdout($string);
    }

Usage Example

Example #1
0
 /**
  *  If in daemon mode - no write to console
  *
  * @param string $string
  *
  * @return bool|int
  */
 public function stdout($string)
 {
     if (!$this->demonize && is_resource(STDOUT)) {
         return parent::stdout($string);
     } else {
         return false;
     }
 }
All Usage Examples Of yii\console\Controller::stdout