當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Json::objectToArray方法代碼示例

本文整理匯總了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);
開發者ID:noikiy,項目名稱:Flexigrid_PHP_Firebird_example,代碼行數:31,代碼來源:listarPessoasJson.php


注:本文中的Json::objectToArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。