Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Warning: preg_match() expects parameter 2 to be string
.::Shaman::.
post
Post #1





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 18.02.2010

Ostrzeżenie: (0%)
-----


Witam!
Być może ten tema był poruszany ale na prawdę jestem totalnie odporny na naukę php. Mój problem wygląda w ten sposób:

Chciał bym zmodyfikować działanie skryptu (sklep internetowy do Joomla) , tak aby e-maile informujące były wysyłane na kilka adresów.Standardowo jest to zrobione w ten sposób że wysyłane są do kupującego i do właściciela sklepu.
Tak wygląda fragment skryptu bez modyfikacji:

Kod
            /*
            * Add the text, html and embedded images.
            * The name of the image should match exactly
            * (case-sensitive) to the name in the html.
            */
            $shopper_mail_Body = $shopper_html;
            $shopper_mail_AltBody = $shopper_header . $shopper_message . $shopper_footer;

            $vendor_mail_Body = $vendor_html;
            $vendor_mail_AltBody = $vendor_header . $shopper_message . $vendor_footer;

            $imagefile = pathinfo($dbv->f("vendor_full_image"));
            $extension = $imagefile['extension'] == "jpg" ? "jpeg" : "jpeg";

            $EmbeddedImages[] = array(    'path' => IMAGEPATH."vendor/".$dbv->f("vendor_full_image"),
                                'name' => "vendor_image",
                                'filename' => $dbv->f("vendor_full_image"),
                                'encoding' => "base64",
                                'mimetype' => "image/".$extension );

            
            $shopper_mail = vmMail( $from_email, $mosConfig_fromname, $shopper_email, $shopper_subject, $shopper_mail_Body, $shopper_mail_AltBody, true, null, null, $EmbeddedImages);

            $vendor_mail = vmMail($from_email, $mosConfig_fromname, $vendor_email, $vendor_subject, $vendor_mail_Body, $vendor_mail_AltBody, true, null, null, $EmbeddedImages, null, $shopper_email);

            if ( !$shopper_mail || !$vendor_mail ) {
                
                $vmLogger->debug( 'Something went wrong while sending the order confirmation email to '.$from_email.' and '.$shopper_email );
                return false;
            }
            //
            // END: set up and send the HTML email
            ////////////////////////////////////////



A tak po wprowadzeniu modyfikacji:

Kod
            /*
            * Add the text, html and embedded images.
            * The name of the image should match exactly
            * (case-sensitive) to the name in the html.
            */
            $shopper_mail_Body = $shopper_html;
            $shopper_mail_AltBody = $shopper_header . $shopper_message . $shopper_footer;

            $vendor_mail_Body = $vendor_html;
            $vendor_mail_AltBody = $vendor_header . $shopper_message . $vendor_footer;

            $imagefile = pathinfo($dbv->f("vendor_full_image"));
            $extension = $imagefile['extension'] == "jpg" ? "jpeg" : "jpeg";

            $EmbeddedImages[] = array(    'path' => IMAGEPATH."vendor/".$dbv->f("vendor_full_image"),
                                'name' => "vendor_image",
                                'filename' => $dbv->f("vendor_full_image"),
                                'encoding' => "base64",
                                'mimetype' => "image/".$extension );

            
            $shopper_mail = vmMail( $from_email, $mosConfig_fromname, $shopper_email, $shopper_subject, $shopper_mail_Body, $shopper_mail_AltBody, true, null, null, $EmbeddedImages);
            
            $addresses = array($vendor_email, 'myaddress@mysite.com');

            $vendor_mail = vmMail($addresses, $from_email, $mosConfig_fromname, $vendor_email, $vendor_subject, $vendor_mail_Body, $vendor_mail_AltBody, true, null, null, $EmbeddedImages, null, $shopper_email);

            if ( !$shopper_mail || !$vendor_mail ) {
                
                $vmLogger->debug( 'Something went wrong while sending the order confirmation email to '.$from_email.' and '.$shopper_email );
                return false;
            }
            //
            // END: set up and send the HTML email
            ////////////////////////////////////////



Różni się on tylko tym że przed zmienną $vendor_mail dodana jest tablica z jednym przykładowym adresem. Po zmianach w kodzie w momencie kiedy powinno zostać wysłane powiadomienie o zamówieniu dostaję taki oto błąd:

Kod
Warning: preg_match() expects parameter 2 to be string, array given in /homez.374/******/www/*****/sklep/administrator/components/com_virtuemart/classes/ps_main.php on line 77



Czy mógł by mi ktoś wytłumaczyć jak to zapisać żeby zamiast tablicy był tam string?
Go to the top of the page
+Quote Post

Posty w temacie


Closed TopicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 25.12.2025 - 15:11