Slim 3 – how to get all get/ put/ post variables?

Get all get/put/post parameters: //GET $allGetVars = $request->getQueryParams(); foreach($allGetVars as $key => $param){ //GET parameters list } //POST or PUT $allPostPutVars = $request->getParsedBody(); foreach($allPostPutVars as $key => $param){ //POST or PUT parameters list } Single parameters value: //Single GET parameter $getParam = $allGetVars[‘title’]; //Single POST/PUT parameter $postParam = $allPostPutVars[‘postParam’];

Slim PHP and GET Parameters

You can do this very easily within the Slim framework, you can use: $paramValue = $app->request()->params(‘paramName’); $app here is a Slim instance. Or if you want to be more specific //GET parameter $paramValue = $app->request()->get(‘paramName’); //POST parameter $paramValue = $app->request()->post(‘paramName’); You would use it like so in a specific route $app->get(‘/route’, function () use ($app) … Read more

enable cors in .htaccess

Since I had everything being forwarded to index.php anyway I thought I would try setting the headers in PHP instead of the .htaccess file and it worked! YAY! Here’s what I added to index.php for anyone else having this problem. // Allow from any origin if (isset($_SERVER[‘HTTP_ORIGIN’])) { // should do a check here to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)