示例#1
0
                               },';
            $id_transporter = $c->get_transporter();
            $transporter = new Transporter($id_transporter);
            $json .= '
                               "transporter" : {
                                        "id" : "' . $transporter->get_id() . '",
                                        "photo" : "' . $transporter->get_photo() . '",
                                        "firstname" : "' . $transporter->get_first_name() . '",
                                        "lastname" : "' . $transporter->get_last_name() . '",
                                        "email" : "' . $transporter->get_email() . '",
                                        "phone" : "' . $transporter->get_phone() . '",
                                        "address" : "' . $transporter->get_address() . '"

                               },
                               "medicines" :[';
            $medicines = $c->get_medicines();
            $second = true;
            foreach ($medicines as $m) {
                if ($second) {
                    $second = false;
                } else {
                    $json .= ',';
                }
                $json .= '{
                                        "id" : ' . $m->get_id() . ',
                                        "name" : "' . $m->get_name() . '",
                                        "description" : "' . $m->get_description() . '",
                                        "dosification" : "' . $m->get_dosification() . '",
                                        "periodicity" : "' . $m->get_periodicity() . '"
                                    }';
            }