Posted By


porquero on 03/28/12

Tagged


Statistics


Viewed 409 times
Favorited by 0 user(s)

Identificador único


/ Published in: PHP
Save to your folder(s)

Obtiene un identificador usando el nombre del host, id del proceso PHP y usando uniqid.
Además se agrega una ruta para ver cómo quedaría almacenada en disco la información.


Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. /* Obtiene un identificador usando el nombre del host, id del proceso PHP y usando uniqid.
  4.  * Además se agrega una ruta para ver cómo quedaría almacenada en disco la información
  5.  */
  6.  
  7. $md5_machine = substr(md5(gethostname()), 0, 3);
  8. $pid = getmypid();
  9. $path = date('Y/m/d/');
  10.  
  11. echo $path . $md5_machine . $pid . uniqid() . "\n";
  12. echo $path . $md5_machine . $pid . uniqid() . "\n";
  13. echo $path . $md5_machine . $pid . uniqid() . "\n";
  14. echo $path . $md5_machine . $pid . uniqid() . "\n";

URL: http://porquero.blogspot.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.