How PHP generates pseudo-static data. Many virtual hosts do not support URL_rewrite. yesterday I saw a classic friend who wrote too much code. I did nothing to study _ SERVER. In fact, it can be very simplified to get www.xxx.com.
Many virtual hosts do not support URL_rewrite.
Yesterday, I saw a classic friend write
I feel that there are too many codes.
I have studied _ SERVER. it can be simplified.
Let's talk about it at http://www.xxx.com/xxx/test.php/article.123456.html.
In this format, _ GET
Http://www.xxx.com/xxx/test.php/article.123456.html
Http://www.xxx.com/xxx/test.php? Article = 123456
========================================
Which format is more handsome.
The code is as follows:
CODE: $ path_info = $ _ SERVER ["PATH_INFO"]; // get PATH_INFO
/* Use regular expressions to match "/article.123456.html "*/
If (eregi ("^/%a-z%%1,16%.%0-9%%1,16%.html $", $ path_info )){
Echo "OK ";
$ Get_path = substr ($ path_info, 1,-5); // processing shape: D remove "/", ". html"
$ Arr_path = explode (., $ get_path); // process it as an array for backup
// Print out the array below to see if we have made a mistake.: cool:
Foreach ($ arr_path as $ key => $ value ){
Echo $ arr_path [. $ key.]:. $ value ."
";
}
} Else echo "NO ";
The result is as follows:
CODE: $ arr_path [0]: article
$ Arr_path [1]: 123456
Use $ _ GET directly. it's so easy to generate pseudo-static in PHP.
Yesterday I also saw a classic friend wrote a feeling that the code is too much. nothing to study the _ SERVER. In fact, it can be very simplified to take http://www.xxx.com...