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