Bonjour,
j'ai une chaine de caractère comme suis :
j'utilise ma fonction replace de cette facon
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 <object width="560" height="340"> <param name="movie" value="http://www.youtube.com/v/q4xDFw5WQlk&hl=fr&fs=1&"></param> <param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube.com/v/q4xDFw5WQlk&hl=fr&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed> </object>
Mais j'ai un message d'erreur de firefox :'(
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 $youtube='<object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/q4xDFw5WQlk&hl=fr&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/q4xDFw5WQlk&hl=fr&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object>'; $pattern = '(<object[^>]width=")([0-9]+)(" height=")([0-9]+)(".+width=")([0-9]+)(" height=")([0-9]+)(".+</object>)'; $pattern = '(<object[^>]width=")([0-9]+)(" height=")([0-9]+)(".+width=")([0-9]+)(" height=")([0-9]+)(".+</object>)'; $replacement = '$1' . '125'. '$3'.'250'.'$5'.'125'.'$7'.'250'.'$9'; echo preg_replace($pattern, $replacement, $youtube);
Warning: preg_replace() [function.preg-replace]: Unknown modifier '(' in C:\wamp\www\test\preg.php on line 9
J'ai essayé de modifier ma variable pattern
ms ceci ne fonctionne toujours pas :s
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 $pattern = '/(<object[^>]width=")([0-9]+)(" height=")([0-9]+)(".+width=")([0-9]+)(" height=")([0-9]+)(".+</object>)/';
Merci de m'aider







Répondre avec citation




Partager