一个生成唯一GUID的方法
function create_guid(){ $id = strtoupper(md5(uniqid(mt_rand(),true))); $h = chr(45);//"_" $tid = chr(123)//"{" .substr($id,0,8).$h .substr($id,8,4).$h .substr($id,12,4).$h .substr($id,16,4).$h .substr($id,20,12) .chr(125);//"}" $tid = str_replace('{','',$tid); $tid = str_replace('}','',$tid); $tid = str_replace('-','',$tid); return $tid; }
逻辑不懂,会生成一个唯一性质的ID