Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
サーバーで画像をホストすることを計画していて、同じ種類のファイル命名暗号化メカニズムを使用したいと考えていました。それは単なるハッシュですか?
はい。
$filename = md5($_SERVER['REQUEST_URI'].$_SERVER['REMOTE_ADDR'].rand(50000000, 900000000000)).$ext;
それは単なるハッシュです。文字 a-zA-Z0-9 があり、6 文字のみのハッシュを選択すると、61,474,519 の一意のファイル名が可能になります。=) 最良の結果を得るには mt_rand 関数を使用してください。