在PHP中将十六进制颜色转换为RGB值 [英] Convert hex color to RGB values in PHP
本文介绍了在PHP中将十六进制颜色转换为RGB值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将 #ffffff
的十六进制颜色值转换为单个RGB值 255 255 255
使用PHP?
解决方案检查PHP的hexdec()和dechex()函数
http://php.net/manual/en/function.hexdec.php
示例:
http://php.net/manual/en/function.hexdec.php
示例:
$ value = hexdec('ff'); // $ value = 255
What would be a good way to convert hex color values like #ffffff
into the single RGB values 255 255 255
using PHP?
解决方案
Check out PHP's hexdec() and dechex() functions http://php.net/manual/en/function.hexdec.php Example:
$value = hexdec('ff'); // $value = 255
这篇关于在PHP中将十六进制颜色转换为RGB值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文