[英]Return json array in php
I am trying to return
a json array in php. 我试图在php中
return
一个json数组。 This is what I tried but only return my first variable 这是我尝试过的但只返回我的第一个变量
return $this->response->withJson(array($todos, $fecha_baja));
my $todos
variable is this 我的
$todos
变量是这个
$todos = $sth->fetchObject();
and my $fecha_baja
和我的
$fecha_baja
$rfbaja=$sth1->fetchObject():
$fecha_baja=$rfbaja->fecha_baja;
but the only thing im getting from the return is the info from $todos
Does anyone know how can i return
both $todos
and $fecha_baja
但是我从退货中得到的唯一东西是来自
$todos
的信息有谁知道我怎么能同时return
$todos
和$fecha_baja
尝试这个
return $this->response->withJson(['todos' => $todos, 'fecha' => $fecha_baja]);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.