Effect:
Code:
<?php//+ —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— ——//+ regular expressions for pseudo-static processing//+ URL:HTTP://L ocalhost/forgestatic/index.php/news-class12-id43.html//+ —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— —— ——//Set Output code header (' content-type:text/html; Charset=utf8 ');//Get parameter information//parameter format: '/news-class12-id43.html ' $_ Urlparam = $_server[' path_info '];//matching mode//Match after format://array//(// [0] = =/news-class12-id43.html// [1] = = news// [2] = class12// [3] = class// [4] = = 12// [5] = = id43// [6] = = id// [ 7] = 43//) $_pattern = ' #^/([a-z]+)-(([a-z]+) ([0-9]+)]-(([a-z]+) ([0-9]+)] \.html$# ';//Receive data parameter $_paramarr = Array ();//Match Get if (Preg_match ($_pattern, $_urlparam, $_paramarr)) {//Print data echo ' <pre> ';p rint_r ($_paramarr); echo ' </pre> ';} else {exit (' parameter format is unusual! ‘);}
Static-pseudo-static technology (PHP regular expression implementation)