i konw how to create guid with asp.Function CreateGUID()
  Randomize Timer
  Dim tmpCounter,tmpGUID
  Const strValid = "0123456789"
  For tmpCounter = 1 To 5
    tmpGUID = tmpGUID & Mid(strValid, Int(Rnd(1) * Len(strValid)) + 1, 1)
  Next
  CreateGUID = tmpGUID
End Function

解决方案 »

  1.   

    rand
    (PHP 3, PHP 4 >= 4.0.0)
    rand -- Generate a random value
    Description
    int rand ( void)int rand ( int min, int max)
    If called without the optional min, max arguments rand() returns a pseudo-random value between 0 and RAND_MAX. If you want a random number between 5 and 15 (inclusive), for example, use rand (5, 15). Remember to seed the random number generator before use with srand<?
    function CreateGUID(){
    for($n=0;$n<5;$n++){
    $CreateGUID.=rand(0,9);
    }
    return $CreateGUID;
    }
    echo CreateGUID();
    ?>
      

  2.   

    用你的思路:
    function CreateGUID(){
    $strValid = "0123456789";
    for($n=0;$n<5;$n++){
    $CreateGUID.=substr($strValid,rand(0,strlen($strValid)-1),1);
    }
    return $CreateGUID;
    }