You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i try to add my own function , but not works
help me to add function in this code for making post request
"Logged in " . $username);
}
/_*
\* Gets the user by id or current user
*
\* @url GET /users/$id
\* @url GET /users/current
_/
public function getUser($id = null)
{
// if ($id) {
// $user = User::load($id); // possible user loading method
// } else {
// $user = $_SESSION['user'];
// }
return array("id" => $id, "name" => null); // serializes object into JSON
}
/_*
\* Saves a user to the database
*
\* @url POST /users
\* @url PUT /users/$id
_/
public function saveUser($id = null, $data)
{
// ... validate $data properties such as $data->username, $data->firstName, etc.
// $data->id = $id;
// $user = User::saveUser($data); // saving the user to the database
$user = array("id" => $id, "name" => null);
return $user; // returning the updated or newly created user object
}
/_*
\* Get Charts
\*
\* @url GET /charts
\* @url GET /charts/$id
\* @url GET /charts/$id/$date
\* @url GET /charts/$id/$date/$interval/
\* @url GET /charts/$id/$date/$interval/$interval_months
_/
public function getCharts($id=null, $date=null, $interval = 30, $interval_months = 12)
{
echo "$id, $date, $interval, $interval_months";
}
/_*
\* Throws an error
\*
\* @url GET /error
*/
public function throwError() {
throw new RestException(401, "Empty password not allowed");
}
}
The text was updated successfully, but these errors were encountered:
sorry for making trouble , everything works fine , on first time i don't get rest server concepts that make this issue (and now you are my guru in php rest server script)
i try to add my own function , but not works
"Logged in " . $username); } /_* \* Gets the user by id or current user * \* @url GET /users/$id \* @url GET /users/current _/ public function getUser($id = null) { // if ($id) { // $user = User::load($id); // possible user loading method // } else { // $user = $_SESSION['user']; // } return array("id" => $id, "name" => null); // serializes object into JSON } /_* \* Saves a user to the database * \* @url POST /users \* @url PUT /users/$id _/ public function saveUser($id = null, $data) { // ... validate $data properties such as $data->username, $data->firstName, etc. // $data->id = $id; // $user = User::saveUser($data); // saving the user to the database $user = array("id" => $id, "name" => null); return $user; // returning the updated or newly created user object } /_* \* Get Charts \* \* @url GET /charts \* @url GET /charts/$id \* @url GET /charts/$id/$date \* @url GET /charts/$id/$date/$interval/ \* @url GET /charts/$id/$date/$interval/$interval_months _/ public function getCharts($id=null, $date=null, $interval = 30, $interval_months = 12) { echo "$id, $date, $interval, $interval_months"; } /_* \* Throws an error \* \* @url GET /error */ public function throwError() { throw new RestException(401, "Empty password not allowed"); } }help me to add function in this code for making post request
The text was updated successfully, but these errors were encountered: