当前位置: 首页>>代码示例>>PHP>>正文


PHP Console::ansiFormatCode方法代码示例

本文整理汇总了PHP中yii\helpers\Console::ansiFormatCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Console::ansiFormatCode方法的具体用法?PHP Console::ansiFormatCode怎么用?PHP Console::ansiFormatCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\helpers\Console的用法示例。


在下文中一共展示了Console::ansiFormatCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ansiFormats

 public function ansiFormats()
 {
     return [['test', 'test'], [Console::ansiFormat('test', [Console::FG_RED]), '<span style="color: red;">test</span>'], ['abc' . Console::ansiFormat('def', [Console::FG_RED]) . 'ghj', 'abc<span style="color: red;">def</span>ghj'], ['abc' . Console::ansiFormat('def', [Console::FG_RED, Console::BG_GREEN]) . 'ghj', 'abc<span style="color: red;background-color: lime;">def</span>ghj'], ['abc' . Console::ansiFormat('def', [Console::FG_GREEN, Console::FG_RED, Console::BG_GREEN]) . 'ghj', 'abc<span style="color: red;background-color: lime;">def</span>ghj'], ['abc' . Console::ansiFormat('def', [Console::BOLD, Console::BG_GREEN]) . 'ghj', 'abc<span style="font-weight: bold;background-color: lime;">def</span>ghj'], [Console::ansiFormat('test', [Console::UNDERLINE, Console::OVERLINED, Console::CROSSED_OUT, Console::FG_GREEN]), '<span style="text-decoration: underline overline line-through;color: lime;">test</span>'], [Console::ansiFormatCode([Console::RESET]) . Console::ansiFormatCode([Console::RESET]), ''], [Console::ansiFormatCode([Console::RESET]) . Console::ansiFormatCode([Console::RESET]) . 'test', 'test'], [Console::ansiFormatCode([Console::RESET]) . 'test' . Console::ansiFormatCode([Console::RESET]), 'test'], [Console::ansiFormatCode([Console::BOLD]) . 'abc' . Console::ansiFormatCode([Console::RESET, Console::FG_GREEN]) . 'ghj' . Console::ansiFormatCode([Console::RESET]), '<span style="font-weight: bold;">abc</span><span style="color: lime;">ghj</span>'], [Console::ansiFormatCode([Console::FG_GREEN]) . ' a ' . Console::ansiFormatCode([Console::BOLD]) . 'abc' . Console::ansiFormatCode([Console::RESET]) . 'ghj', '<span style="color: lime;"> a <span style="font-weight: bold;">abc</span></span>ghj'], [Console::ansiFormat('test', [Console::FG_GREEN, Console::BG_BLUE, Console::NEGATIVE]), '<span style="background-color: lime;color: blue;">test</span>'], [Console::ansiFormat('test', [Console::NEGATIVE]), 'test'], [Console::ansiFormat('test', [Console::CONCEALED]), '<span style="visibility: hidden;">test</span>']];
 }
开发者ID:howq,项目名称:yii2,代码行数:4,代码来源:ConsoleTest.php

示例2: log

 public function log($type, $color, $string, $base = [Console::NORMAL], $colors = NULL)
 {
     if (!sizeof($colors)) {
         $colors = [[Console::FG_YELLOW], [Console::FG_BLUE]];
     }
     echo Console::ansiFormat('[', [Console::NORMAL]);
     echo Console::ansiFormat($type, $color);
     echo Console::ansiFormat('] ', [Console::NORMAL]);
     $string = ']]' . $string;
     $string = str_replace(']]', Console::ansiFormatCode([Console::NORMAL]) . Console::ansiFormatCode($base), $string);
     for ($i = 1; $i < 10; $i++) {
         if (isset($colors[$i])) {
             $clr = $colors[$i];
         } else {
             $clr = $colors[0];
         }
         $string = str_replace("[[{$i}", Console::ansiFormatCode($clr), $string);
     }
     $string = str_replace('[[', Console::ansiFormatCode($colors[0]), $string);
     $string .= Console::ansiFormatCode([Console::NORMAL]) . "\n";
     echo $string;
 }
开发者ID:simplator,项目名称:yii2-quickrbac,代码行数:22,代码来源:QuickRBAC.php


注:本文中的yii\helpers\Console::ansiFormatCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。