×

Welcome to TagMyCode

Please login or create account to add a snippet.
1
0
 
1
Language: PHP
Posted by: A973C FR
Added: Sep 24, 2012 5:58 AM
Views: 86
  1.     .htaccess
  2.     RewriteEngine On
  3.     RewriteCond %{REQUEST_FILENAME} !-f
  4.     RewriteCond %{REQUEST_FILENAME} !-d
  5.     RewriteRule ^(.*)$ $1.php [L,QSA]
  6.     # http://domain/about -> http://domain/about.php
  7.      
  8.     --------------------------------------------------
  9.      
  10.     .htaccess
  11.     RewriteEngine On
  12.     RewriteCond %{REQUEST_FILENAME} !-f
  13.     RewriteCond %{REQUEST_FILENAME} !-d
  14.     RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
  15.     # http://domain/about -> http://domain/index.php?q=about
  16.      
  17.     <?php
  18.         function string_to_underscore_name($string) {
  19. $string = preg_replace('/[\'"]/', '', $string);
  20. $string = preg_replace('/[^a-zA-Z0-9]+/', '_', $string);
  21. $string = strtolower(trim($string, '_'));
  22. return $string;
  23. }
  24. echo string_to_underscore_name("13: inside movie films```''''---\//\Bye!?");
  25. //Output: 13_inside_movie_films_bye
  26.  
  27.     // $url_data is an array
  28.     $url_data = explode("/",$HTTP_SERVER_VARS['PATH_INFO']);
  29.     ?>
  30.