Fonksiyonu Çoklu tepkiler

0 Cevap php

Bu işlev dizide birden fazla sonuç için çalışıyorum (?).

Yani temelde yerine lookup("354534", "name"); ve farklı sonuçlar için lookup("354534", "date"); mutiple kez çalışan, nasıl isim ve hem de dönebilirsiniz Bu işlevi tarih, o yüzden sadece bir kez işlevini kullanmak zorunda dışarı echo?

    function lookup($data, $what)
 {
  $json = file_get_contents("http://site.com/".$data.".json");
  $output = json_decode($json, true);  
  echo $output['foo'][''.$what.''];
 }

Teşekkürler!

0 Cevap