Home > Backend Development > PHP Tutorial > Method to return to a secondary directory by ID

Method to return to a secondary directory by ID

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-25 09:07:05
Original
1304 people have browsed it
  1. /*
  2. Secondary directory
  3. Returns a secondary directory by ID, which is used to evenly distribute the content in 36*36 directories.
  4. 36 directories are a-z0-9
  5. */
  6. function IDcat($id){
  7. $p0 = $id % 1296;
  8. $p1 = ceil($p0 / 36)-1;
  9. $p2 = ($ p0-1) % 36 ;
  10. return IDnum($p1).'/'.IDnum($p2).'/';
  11. }
  12. function IDnum($i){
  13. if($i<10){
  14. if ($i==-1){
  15. return 'z';
  16. }else{
  17. return $i;
  18. }
  19. }else{
  20. return chr(87+$i);
  21. }
  22. }
  23. ?>
Copy code


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template