複製程式碼程式碼如下:
function hex 0] == '#') {
$color = substr ( $colour, 1 );
} list ( $r, $g, $b ) = array ($colour [0] . $colour [1], $colour [2] . $顏色[3] , $顏色[4] . $顏色[5] );
} elseif (strlen ( $colour ) == 3) {
list ( $r, $g, $b ) = array ($colour [0] . $colour [0], $colour [1] $顏色[11] $顏色[1 ], $顏色[2] );
} else {
回中false;
$g = 十六進位( $g );
$b = 十六進位( $b );
return array ('red' => $r, 'green' => $g, 'blue' => $b ) ;
}
$b = hex2rgb ("#ff0");
print_r ( $b );
? >
http://www.bkjia.com/PHPjc/313586.html
www.bkjia.com
truehttp: //www.bkjia.com/PHPjc/313586.htmlTechArticle複製程式碼如下: ?php function hex2rgb($colour) { if ($colour [0] == ' # ') { $color = substr ( $color, 1 ); } if (strlen ( $colour ) == 6) { list ( $r, $g, $b ) = array...