jeudi 13 octobre 2016

use dynamic variables in config file

I make a validation check with google recaptcha here is to controller part to get google response:

$response=json_decode(file_get_contents("http://ift.tt/1vh5G4o".\Config::get('app.googlesecretkey')."&response=".$request['g-recaptcha-response']."&remoteip=".$_SERVER['REMOTE_ADDR']), true);

I am have this check many place so I wonder I can use this line as global variable because url of google can change(its thight I know) I already save my secret api key in config/app file and I tried simpy copy paste to config file but throws exception as you guess regarding to variables

'$request[], $_SERVER[]'

Is there any way achieve this or its simply impossible ?

config file contents:

return [

//its ok
'googlesecretkey'=>'6LdCGg..
//its not ok
//'googlevalidation'=>'http://ift.tt/1AMIfbj...



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire