Membuat format Json di Yii2

Langsung aja he scriptnya pake ini


public function actionList($id,$kdskpd)
{
$nip= $this->Nip($id);
$sql="select A.*,B.nama,C.uraian as nmgol from pnsgaji15 A"
. " inner join pnsmain B on A.nip=B.nip "
. " inner join ref_pangkat C on A.kdgol=C.kdgol "
. " where A.nip='$nip' and A.kdskpd='$kdskpd' and A.bulan='04'";

$conn= Yii::$app->db;
$cmd=$conn->createCommand($sql);
$users=$cmd->queryAll();
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
return $users;
}

hasilnya

Capture

naa selanjutnya bisa deh dipake buat nampilin di andorid hehe, kaya gini

Screenshot_2015-12-15-09-42-33

hehe beres deh, makasih Yii

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: