PHP generate friendly URLs
Function: generate a friendly URL to facilitate URL SEO
Supports Chinese, Korean, Japanese, and English.
I hope you can improve your skills. [PHP] code
Public function friendlyURL ($ string, $ replacement = '-') {$ map = array ('/à | á | alias | â | ä/' => 'A ', '/è | é | percent/' => 'e', '/percent | í | percent/' => 'I ', '/Upper | ó | lower | ø/' => 'O', '/lower | ú| lower | lower/' => 'u ', '/c | response/' => 'C', '/n | response/' => 'N', '/response/' => 'L ', '/keys/' => 'y', '/keys/' => 'T', '/keys/' => 'Z ', '/â/' =>'s ','/queues/'=>' AE ','/ö/ '=> 'Oe ', '/u/' => 'ue ','/ä/ '=>' AE ','/u/'=> 'ue ', '/ö/' => 'Oe ','/Lower/'=> 'SS',' // '=> '','/~ | · |! | @ | # | ¥ | % |... | & | × | (|) |-| \ + | = | '| [|' |] |, |: |; | "|" | '|, | "|. |? | \/|-| _ | '|: | √ | <| ° |,' => '', '/[^ \ W \ s \ x80-\ xff]/' => '', '/\ s +/' => $ replacement ); $ string = trim ($ string); $ string = preg_replace (array_keys ($ map), array_values ($ map), $ string ); $ string = preg_replace ('/\ s +/', $ replacement, strtolower ($ string); $ string = trim ($ string, $ replacement ); return $ string ;}