PHP uniqid() လုပ်ဆောင်ချက်
ဥပမာ
ထူးခြားသော ID တစ်ခုကို ဖန်တီးပါ-
<?php
echo uniqid();
?>
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
uniqid() လုပ်ဆောင်ချက်သည် မိုက်ခရိုအချိန် (မိုက်ခရိုစက္ကန့်အတွင်း လက်ရှိအချိန်) ကို အခြေခံ၍ သီးခြား ID တစ်ခုကို ထုတ်ပေးသည်။
မှတ်ချက်- ဤလုပ်ဆောင်ချက်မှ ထုတ်လုပ်လိုက်သော ID သည် ပြန်တန်ဖိုး၏ ထူးခြားမှုကို အာမမခံနိုင်ပါ။ ခန့်မှန်းရအလွန်ခက်ခဲသော ID တစ်ခုကို ဖန်တီးရန် md5() လုပ်ဆောင်ချက်ကို အသုံးပြုပါ။
အထားအသို
uniqid(prefix,more_entropy)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
prefix | Optional. Specifies a prefix to the unique ID (useful if two scripts generate ids at exactly the same microsecond) |
more_entropy | Optional. Specifies more entropy at the end of the return value. This will make the result more unique. When set to TRUE, the return string will be 23 characters. Default is FALSE, and the return string will be 13 characters long |
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | စာကြောင်းတစ်ကြောင်းအဖြစ် သီးသန့်သတ်မှတ်သူကို ပြန်ပေးသည်။ |
---|---|
PHP ဗားရှင်း- | 4+ |
ပြောင်းလဲမှုမှတ်တမ်း- | နောက်ဆက်တွဲ ပါ ရာ မီတာသည် PHP 5.0 တွင် ရွေးချယ်ခွင့်ဖြစ်လာသည်။ စာလုံးပေါင်း 114 လုံး၏ ကန့်သတ်ချက်ကို PHP 4.3.1 တွင် မြှင့်တင်ထားသည် ။ |
❮ PHP Misc အကိုးအကား