本文整理汇总了PHP中Json::objectToArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Json::objectToArray方法的具体用法?PHP Json::objectToArray怎么用?PHP Json::objectToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Json
的用法示例。
在下文中一共展示了Json::objectToArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: json_encode
$end = $rp;
} else {
$start = ($page - 1) * $rp + 1;
$end = $page * $rp;
}
$limit = "ROWS {$start} to {$end} ";
$where = "";
if ($query) {
$where = " WHERE {$qtype} CONTAINING '" . $query . "' ";
}
$sql = "SELECT * FROM SEL_USUARIOS_EMPRESA_GRID(" . $params . "," . $params2 . ") {$where} {$sort} {$limit}";
//echo $sql."</br>";
$result = runSQL($sql);
$total = countRec('IDUSUARIO', 'SEL_USUARIOS_EMPRESA_GRID(' . $params . ',' . $params2 . ')');
$objJson = new Json();
$valorArray = $objJson->objectToArray($result);
$total = $objJson->objectToArray($total);
$total = $total[0]['COUNT'];
//header("Content-type: application/json");
$jsonData = array('page' => $page, 'total' => $total, 'rows' => array());
foreach ($valorArray as $row) {
if ($row['ATIVO'] == 1) {
$row['ATIVO'] = 'Sim';
} else {
$row['ATIVO'] = 'Não';
}
$entry = array('counter' => $row['IDUSUARIO'], 'cell' => array('IDUSUARIO' => $row['IDUSUARIO'], 'NOME' => strtoupper($row['NOME']), 'CODIGO' => $row['CODIGO'], 'IDIDIOMA' => $row['IDIDIOMA'], 'IDIOMA' => $row['IDIOMA'], 'LOGIN' => $row['LOGIN'], 'ATIVO' => $row['ATIVO'], 'TELEFONE' => $row['TELEFONE'], 'IDPERFIL' => $row['IDPERFIL'], 'PERFIL' => $row['PERFIL'], 'OBSERVACAO' => $row['OBSERVACAO']));
$jsonData['rows'][] = $entry;
}
echo json_encode($jsonData);
//print_r($jsonData);