lundi 21 décembre 2015

Laravel Cache seems don't work properly

I'm new to Laravel. I use Cache Facade to cache some data on the server, the cache driver is "file". Below is part of my code has problem: line 147 if (Cache::has('votes_record')) { line 148 $votes_record = Cache::get('votes_record'); line 149 if (array_key_exists($input['From'], $votes_record)){ // do something here } } this is the error message: exception 'ErrorException' with message 'array_key_exists() expects parameter 2 to be array, null given' in /app/Http/Controllers/VotesController.php:149

So it said the $votes_record is null, but I check if this Cache item exists on line 147, and it pass the check, so it means the Cache item exists, why it return null on line 148?

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire