使用字符串作为PHP中的“键”生成唯一字符串

I need to generate a unique string in PHP.

Currently I'm using a technique like this

$clipId = base_convert(microtime(), 8, 36);

However, as this is based on time, the ID changes when the page is re-rendered, and I need to to always remain the same.

If there would be a way to feed in the image URL and the post-title as strings to output an alphanumeric ID, that would be perfect, and 'random' enough for what I need to do here. Also if it were possible to get the unix-time the image was uploaded to Wordpress (together with the time the unix-time the post was created), I could use that.

So, you want an algorithm that turns one string into another string. That's not random, that's either an encoding or a hash. An encoding expresses the same value merely in different terms, for example base64_encode. You can convert between the original string and the encoded form back and forth as often as you like.

Alternatively you probably want a hash like SHA1 or MD5 to turn arbitrary input into a fixed-length output. You can not convert a hash back into its original value.

Alternatively you can use an entirely arbitrary random string generated with a pseudo random number generator. These generators need to be seeded with an initial value, and will then return a predictable and repeatable series of seemingly random numbers. If you seed it with the same value, it will return you the same random number sequence. You can use that to produce random numbers which have no direct connection with your string yet are still reproducible when necessary. e.g. mt_rand, mt_srand.