php - Remove header value from the response -
i have laravel system , storing 1 of response in particular file :
$objfile = new filesystem(); $path = "files/filename.php"; $string = $this->getslides(); if ($objfile->exists($path)) { $objfile->put($path,"",$lock = false); $objfile->put($path,$string,$lock = false); $objfile->getrequire($path); } else return getcwd() . "\n";
now contents using following lines:
$objfile = new filesystem(); $path = "files/filename.php"; if ($objfile->exists($path)) { return response::json([$objfile->getrequire($path)],200); } else return getcwd() . "\n";
now what's happening when store file on server adds header :
http/1.0 200 ok cache-control: no-cache content-type: application/json date: thu, 10 nov 2016 05:38:08 gmt
followed stored file , when call file on frontend , following error :
syntaxerror: unexpected token h in json @ position 0(…)
of course expects me json value m giving doesn't start 1. idea how can remove on php level?
you using wrong method getting file content.
$objfile->getrequire($path)
- execute following code chunk: return require $path;
. have use $objfile->get($path)
file's content.
Comments
Post a Comment