Jump to content
php.lv forumi

Iesakiet SaaS priekš datu apstrādes


Kasspars

Recommended Posts

Varbūt kāds zina servisu (API), kurā var iesūtīt datu vienības json formātā. Tālāk vajag, lai tas serviss piedāvā web interfeisu, kurā es varu uztaisīt tabulu ar manām nodefinētajām kolonnām.

Tabulā tiktu attēloti mani iepriekš iesūtītie dati.

Varētu pats to visi tasīt, bet baigi negribās, jo tie dati netiks ilgi glabāti un pēc pāris nedēļām nevienam vairs nebūs vajadzīgi

Link to comment
Share on other sites

$array = json_decode($json, true);

$cols = [
     'user.fullName' => 'Name',
     'user.email' => 'Email',
     'something' => 'Somethingl',
];

foreach($array as $row){
    foreach($cols as $colKey => $colTitle){
         echo "<td>" . array_get($row, $colKey) . '</td>';
   } 
}


array_get no Laravel, kas saprot dot pierakstu. Moš pietiek :) A tā savādāk, grūti saprast, ko gribi panākt bez jebkādiem datu exampļiem...

Link to comment
Share on other sites

  • 5 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...