How to POST data as array in FlightPHP

FlightPHP is a fast, simple, extensible framework for PHP. Flight enables you to quickly and easily build RESTful web applications.

<?php
Flight::route(‘POST /post-meta’, function(){
print_r($_POST);
});
?>

<?php
Flight::route(‘POST /report’, function(){
if(isset($_POST[‘reportcode’])){
$id = (int)base64_decode($_POST[‘reportcode’]);
if(Flight::db()->count() == 0){
$return[‘status’] = “ok”;
$return[‘content’] = “<b>Succesfuly</b> sent your report this link”;
}else{
$return[‘status’] = “already”;
$return[‘content’] = “<b>Already</b> this link reported”;
}
}else{
$return[‘status’] = 0;
}
echo json_encode($return);
});
?>

If you understand this program then ball is in your court because it is one of the favorable question in PHP interview.

Find out positive reviews received by SynapseIndia for their PHP website development.
Employees at SynapseIndia work with motto to provide client satisfaction without giving them any chance to complaints in any cases.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>