ciao!
dovrei creare un file che esponga i dati in json in questo formato:
codice:
{
"success": 1,
"result": [
{
"id": "293",
"title": "This is warning class event with very long title to check how it fits to evet in day view",
"url": "http://www.example.com/",
"class": "event-warning",
"start": "1362938400000",
"end": "1363197686300"
},
{
"id": "256",
"title": "Event that ends on timeline",
"url": "http://www.example.com/",
"class": "event-warning",
"start": "1363155300000",
"end": "1363227600000"
}
]
}
prendendoli da db non riesco a capire come dargli quella struttura:
Codice PHP:
<?php
include_once '../lib/costanti_file.php';
$appuntamenti = new Appuntamenti(Connessione::getInstance());
$rows = array();
$rows['success'] = 1;
$rows['result'] = '[';
foreach ($appuntamenti->getAppuntamenti() as $a) {
$rows[] = array(
'id' => $a['ap_id'],
'title' => $a['ap_titolo'],
'url' => '',
'class' => 'event-warning',
'start' => '1362938400000',
'end' => '1363227600000'
);
}
// CHIUSURA QUADRA ??
echo json_encode($rows);
avete qualche idea??