mirror of
https://git.steelants.cz/SH/PHP_SMART_HOME_V3.git
synced 2026-10-11 17:54:34 +00:00
examples
This commit is contained in:
1 parent
56891bda09
commit
f588a293ed
4 files changed
+51
No files matched your search
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
class ExampleApi extends ApiController{
|
||||
|
||||
public function example(){
|
||||
// if this function should be accessible only for logged users uncomment next line
|
||||
// $this->requireAuth();
|
||||
// if user is logged in, next lines will be processed
|
||||
// otherwise script get terminated with 401 UNAUTHORIZED
|
||||
|
||||
|
||||
// input data are stored in $this->input
|
||||
// in this example we just copy input to response
|
||||
$response = $this->input;
|
||||
|
||||
|
||||
// this method returns response as json
|
||||
$this->response($response);
|
||||
// you can specify returned http code by second optional parameter
|
||||
// default value is 200
|
||||
// $this->response($response, $httpCode);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user