Prayer !! Posted August 5, 2009 Report Share Posted August 5, 2009 (edited) Tā nu saskāros ar problēmu, kad man izmeta šadu bridinajumu: Warning: preg_replace() [function.preg-replace]: Empty regular expression ............ koda gabaliņš kura dēļ šis bridinājums tika izmests ir zemāk: $title = $_POST['title']; $pattern = array('/ē/','/ū/','/ī/','/ā/','/š/','/ģ/','/ķ/','/ļ/','/ž/','/č/','/ņ/','/Ē/','/Ū/','/Ī/','/Ā/','/Š/','/Ģ/','/Ķ/','/Ļ/','/Ž/','/Č/','/Ņ/','/\//', '/\^/', '/\./', '/\$/', '/\|/','/\(/','/\)/','/\[/','/\]/','/\*/','/\+/','/\?/','/\{/','/\}/','/\,/','/!/','/@/','/#/','/%/','/&/','/=/',' '); $replace = array('e','u','i','a','s','g','k','l','z','c','n','E','U','I','A','S','G','K','L','Z','C','N','','','','','','','','','','','','','','','','','','','','','','','','','','','_'); $titleUrl = preg_replace($pattern,$replace,$title); $_POST['title'] ir vienkars raksta nosaukums. Edited August 5, 2009 by Prayer !! Quote Link to comment Share on other sites More sharing options...
marrtins Posted August 5, 2009 Report Share Posted August 5, 2009 (edited) Aizstāj ' ' ar '/\s/' Edited August 5, 2009 by marrtins Quote Link to comment Share on other sites More sharing options...
endrju Posted August 5, 2009 Report Share Posted August 5, 2009 Tā nu saskāros ar problēmu, kad man izmeta šadu bridinajumu: Warning: preg_replace() [function.preg-replace]: Empty regular expression ............ koda gabaliņš kura dēļ šis bridinājums tika izmests ir zemāk: $title = $_POST['title']; $pattern = array('/ē/','/ū/','/ī/','/ā/','/š/','/ģ/','/ķ/','/ļ/','/ž/','/č/','/ņ/','/Ē/','/Ū/','/Ī/','/Ā/','/Š/','/Ģ/','/Ķ/','/Ļ/','/Ž/','/Č/','/Ņ/','/\//', '/\^/', '/\./', '/\$/', '/\|/','/\(/','/\)/','/\[/','/\]/','/\*/','/\+/','/\?/','/\{/','/\}/','/\,/','/!/','/@/','/#/','/%/','/&/','/=/',' '); $replace = array('e','u','i','a','s','g','k','l','z','c','n','E','U','I','A','S','G','K','L','Z','C','N','','','','','','','','','','','','','','','','','','','','','','','','','','','_'); $titleUrl = preg_replace($pattern,$replace,$title); $_POST['title'] ir vienkars raksta nosaukums. Šādam repleisam iesaku uzmantot strtr(); Quote Link to comment Share on other sites More sharing options...
Prayer !! Posted August 5, 2009 Author Report Share Posted August 5, 2009 (edited) liels paldies :) ok izmēģināšu strtr() funkciju ;) Edited August 5, 2009 by Prayer !! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.