Generating a random hex color code with PHP

后端 未结 13 2289
半阙折子戏
半阙折子戏 2020-11-28 04:21

I\'m working on a project where I need to generate an undefined number of random, hexadecimal color codes…how would I go about building such a function in PHP?

13条回答
  •  [愿得一人]
    2020-11-28 05:07

    I think this would be good as well it gets any color available

    $color= substr(str_shuffle('AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899'), 0, 6);
    

提交回复
热议问题