{"id":1774,"date":"2017-06-10T22:19:07","date_gmt":"2017-06-10T14:19:07","guid":{"rendered":"https:\/\/blog.vimge.com\/?p=1774"},"modified":"2017-06-14T22:31:27","modified_gmt":"2017-06-14T14:31:27","slug":"php-command-line-color","status":"publish","type":"post","link":"https:\/\/blog.vimge.com\/archives\/php\/php-command-line-color.html","title":{"rendered":"PHP\u5982\u4f55\u63a7\u5236\u7ec8\u7aef\u8f93\u51fa\u6587\u5b57\u989c\u8272"},"content":{"rendered":"

\u7ecf\u5e38\u78b0\u5230\u4e00\u4e9b\u8bed\u8a00\u5728\u7ec8\u7aef\u4e0b\u6267\u884c\u7684\u65f6\u5019\u4e3a\u4ec0\u4e48\u53ef\u4ee5\u8f93\u51fa\u4e00\u4e9b\u5f69\u8272\u7684\u6587\u5b57\u6837\u5f0f\uff0c\u4eca\u5929\u521a\u597d\u6267\u884c composer \u5de5\u5177\u7684\u5e2e\u52a9\u65f6\u5019\u53d1\u73b0\u7adf\u7136PHP\u4e5f\u53ef\u4ee5\u5b9e\u73b0\u8fd9\u6837\u7684\u6548\u679c\uff08composer\u662f\u4e00\u4e2aPhar\u5305\u7a0b\u5e8f\uff0c\u672c\u8d28\u4e0a\u5c31\u662f\u4e00\u4e2aPHP\u7a0b\u5e8f\u5305\uff09<\/p>\n

\u7ecf\u8fc7\u7814\u7a76\u53d1\u73b0\u5176\u5b9e\u539f\u7406\u633a\u7b80\u5355\uff0c\u770b\u770b\u4e0b\u9762\u8fd9\u6bb5\u6267\u884c\u7684PHP\u4ee3\u7801\u6548\u679c<\/p>\n

\n

$php -r “echo \\”\u7528\\\\033[0;32mPHP\\\\033[0m\\\\033[41m\u8f93\u51fa\u4e00\u6bb5\\\\033[0;31m\u5f69\\\\033[0;33m\u8272\\\\033[0;34m\u6587\\\\033[0;35m\u5b57 \\\\033[0m \\n\\”;”<\/span><\/p>\n<\/blockquote>\n

\"PHP\u5728\u7ec8\u7aef\u8f93\u51fa\u5f69\u8272\u6587\u5b57\"<\/p>\n

\u5176\u5b9e\u80cc\u540e\u539f\u7406\u5f88\u7b80\u5355\uff0c\u5206\u6790\u4e0a\u9762\u7684\u4ee3\u7801\u53ef\u4ee5\u770b\u5230\u4e00\u4e32\u7531 \\033[ \u5f00\u59cb\u7684\u5b57\u7b26\uff0c\u5176\u5b9e\u8fd9\u4e00\u6bb5\u5b57\u7b26\u662f\u7528\u4e8e\u5f15\u5bfc\u975e\u5e38\u89c4\u5b57\u7b26\u5e8f\u5217\uff0c\u5728\u8fd9\u91cc\u7684\u4f5c\u7528\u5c31\u662f\u5f15\u5bfc\u8bbe\u7f6e\u8f93\u51fa\u5c5e\u6027\uff0c\u540e\u8fb9\u7684[32m\u5c31\u662f\u5c06\u524d\u666f\u8272\u8bbe\u7f6e\u4e3a\u7eff\u8272\uff0c\u5b57\u6bcdm\u8868\u793a\u8bbe\u7f6e\u7684\u5c5e\u6027\u7c7b\u522b\uff0c\u6570\u5b57\u4ee3\u8868\u5c5e\u6027\u503c\u3002\u540c\u7c7b\u7684\u591a\u79cd\u8bbe\u7f6e\u9879\u53ef\u4ee5\u7ec4\u5408\u5728\u4e00\u8d77\uff0c\u4e2d\u95f4\u7528\u5206\u53f7\uff08;\uff09\u9694\u5f00\u3002<\/p>\n

\u9664\u8bbe\u7f6e\u6587\u672c\u989c\u8272\u4ee5\u5916\uff0c\u8fd8\u4ee5\u53ef\u8bbe\u7f6e\u4ee5\u4e0b\u5c5e\u6027\uff1a<\/p>\n

\\033[0m \u5173\u95ed\u6240\u6709\u5c5e\u6027
\n\\033[1m \u8bbe\u7f6e\u9ad8\u4eae\u5ea6
\n\\033[4m \u4e0b\u5212\u7ebf
\n\\033[5m \u95ea\u70c1
\n\\033[7m \u53cd\u663e
\n\\033[8m \u6d88\u9690
\n\\033[30m \u81f3 \\33[37m \u8bbe\u7f6e\u524d\u666f\u8272
\n\\033[40m \u81f3 \\33[47m \u8bbe\u7f6e\u80cc\u666f\u8272
\n\\033[nA \u5149\u6807\u4e0a\u79fbn\u884c
\n\\033[nB \u5149\u6807\u4e0b\u79fbn\u884c
\n\\033[nC \u5149\u6807\u53f3\u79fbn\u884c
\n\\033[nD \u5149\u6807\u5de6\u79fbn\u884c
\n\\033[y;xH\u8bbe\u7f6e\u5149\u6807\u4f4d\u7f6e
\n\\033[2J \u6e05\u5c4f
\n\\033[K \u6e05\u9664\u4ece\u5149\u6807\u5230\u884c\u5c3e\u7684\u5185\u5bb9
\n\\033[s \u4fdd\u5b58\u5149\u6807\u4f4d\u7f6e
\n\\033[u \u6062\u590d\u5149\u6807\u4f4d\u7f6e
\n\\033[?25l \u9690\u85cf\u5149\u6807
\n\\033[?25h \u663e\u793a\u5149\u6807<\/p>\n

\u5404\u6570\u5b57\u6240\u4ee3\u8868\u7684\u989c\u8272\u5982\u4e0b\uff1a<\/p>\n

\u5b57\u80cc\u666f\u989c\u8272\u8303\u56f4:40—-49
\n40:\u9ed1
\n41:\u6df1\u7ea2
\n42:\u7eff
\n43:\u9ec4\u8272
\n44:\u84dd\u8272
\n45:\u7d2b\u8272
\n46:\u6df1\u7eff
\n47:\u767d\u8272<\/p>\n

\u5b57\u989c\u8272:30———–39
\n30:\u9ed1
\n31:\u7ea2
\n32:\u7eff
\n33:\u9ec4
\n34:\u84dd\u8272
\n35:\u7d2b\u8272
\n36:\u6df1\u7eff
\n37:\u767d\u8272<\/p>\n

OK\uff0c\u638c\u63e1\u4ee5\u4e0a\u5c5e\u6027\u8bbe\u7f6e\u5c31\u53ef\u4ee5\u5b8c\u6210\u5f88\u591a\u6709\u8da3\u73a9\u6cd5\u4e86\uff0c\u800c\u4e14\u4ee5\u6b64\u7c7b\u63a8\u5176\u4ed6\u8bed\u8a00\u4e5f\u53ef\u4ee5\u8fd9\u6837\u73a9\u3002<\/p>\n

 <\/p>\n

\u5f15\u7528<\/strong>
\nhttp:\/\/blog.csdn.net\/acmee\/article\/details\/6613060<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"

\u7ecf\u5e38\u78b0\u5230\u4e00\u4e9b\u8bed\u8a00\u5728\u7ec8\u7aef\u4e0b\u6267\u884c\u7684\u65f6\u5019\u4e3a\u4ec0\u4e48\u53ef\u4ee5\u8f93\u51fa\u4e00\u4e9b\u5f69\u8272\u7684\u6587\u5b57\u6837\u5f0f\uff0c\u4eca\u5929\u521a\u597d\u6267\u884c composer \u5de5\u5177\u7684\u5e2e\u52a9 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1774"}],"collection":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/comments?post=1774"}],"version-history":[{"count":1,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1774\/revisions"}],"predecessor-version":[{"id":1777,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1774\/revisions\/1777"}],"wp:attachment":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/media?parent=1774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/categories?post=1774"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/tags?post=1774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}