Hello there,
Is it possible to have 2 method within the same endpoint file?
I have followed the tutorial:
But I would like to have more than one method (get, post, put) within one file,
please advise, thanks!!
Hello there,
Is it possible to have 2 method within the same endpoint file?
I have followed the tutorial:
But I would like to have more than one method (get, post, put) within one file,
please advise, thanks!!
Hello,
You can use multiple methods within the same point but you have to put some condition over there to handle multiple methods.
For ex:
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
... handle form submission here ...
}
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
... handle form submission here ...
}
if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
... handle form submission here ...
}
?>
Hey thanks!!
But from the example:
Line 24:
//method to call
'method' => 'MyGetMethod'
we have to registered the method, how can we have 3 method registered?
Please advise, Thanks!!
Hey thanks!!
But from the example:
Line 24:
//method to call
'method' => 'MyGetMethod'
we have to registered the method, how can we have 3 method registered?
Please advise, Thanks!!