api.php
ไฟล์ api.php และตัวอย่างการใช้งาน
ตัวอย่างไฟล์ api.php ที่ส่งข้อมูลออกเป็น JSON
api.php ที่ส่งข้อมูลออกเป็น JSON$opt = ( isset( $_GET[ 'opt' ] ) ? $_GET[ 'opt' ] : null );
if ( $opt == "list" ) {
foreach ( $_DB->get( 'buddy_name' ) as $_USER ) {
$buddy = $_DB->where( 'buddy_to', $_USER[ 'bs_name' ] )->getValue( 'event_buddy', 'count(*)' );
$data[] = [
'name' => $_USER[ 'bs_name' ],
'office' => $_USER[ 'bs_provider' ],
'status' => ( $buddy == 0 ? true : false ),
];
}
shuffle( $data );
exit( json_encode( $data ) );
}Last updated