試一下php解譯器的代碼高亮輸出

來源:互聯網
上載者:User

一直喜歡ue9裡面對php的預設色彩設定,橙色紅色的,ue10改成關鍵字藍色了,我又改回來了:

現在想試試php.exe的代碼高亮輸出與我的喜好一致,仔細調了一下php.ini,並嘗試了一些新顏色:

highlight.string  = #808080
highlight.comment = #008000
highlight.keyword = #FF8000
highlight.bg      = #E0E0E0
highlight.default = #800000
highlight.html    = #0080FF

然後php -q -s test.php>test.html
下面是效果:

<?php
$a='123';
$b='abc';
?>
<table>
    <tr><td>
<?php
//comments
if(true)
{
    echo $a.$b;
}
?>
    </td></tr>
</table>

補:但是也不能只顧自己欣賞,代碼是給人看的,上網看了很多其他的色彩配置,總結一下:

1。剛才那樣就是ue9的風格,關鍵字橙色,變數深紅,字串灰色,注釋深綠,html藍色

2。php.net官網所有的代碼舉例採用了php.ini的預設配置色彩,關鍵字綠色,字串紅色,注釋橙色,html黑色,普通文字(變數和其他標識符)藍色:

// How to hold objects in an arrayList and retrieve it //
// Interface implementation //

class Data {
  
   public $Name;
   public $Age;
   public $Address;
  
   public function __construct($Name,$Age,$Address) {
       $this->Name = $Name;
       $this->Age = $Age;
       $this->Address = $Address;
   }
  
   public function __destruct() {
       echo "Default Constructor.../n";
   }

}

3。很奇怪pear官網的大部分代碼舉例採用了另一種色彩,關鍵字紫色,字串綠色,注釋灰色普通文字藍色:

// Create a Cache_Lite object$Cache_Lite = new Cache_Lite($options);if ($data = $Cache_Lite->get('block1')) {    echo($data);} else {    $data = 'Data of the block 1';    $Cache_Lite->save($data);}

4。當然還逃不了一種色彩,就是MS VS風格的,很多win下的php編輯器喜歡用,ue10, phpedit, devphp, zendstudio等,關鍵字藍色,注釋綠色,(有時候還有字串灰色,數字紅色等),其他黑色

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.