AngularJS not write parameters to PHP -
i'm working on application , have problems when writing file php hosting angular data.
i have variable in controller angularjs "$scope.variables" , want pass php , able write file
what miss write controller in 1 http.post send parameters.
in log of browser console see changing data in json file when writing file php me rewrites json file defecto.no write changes made.
in controller have this, send variables php page
$http.post ('http: //localhost/proyectos/3.0copy/app/partials/createjson.php data', data) .then (function () { console.log ($scope.variables); });
that when run "exporting sass" should generate json file
i not know how make these modified angular me pass data php.
and createjson.php file this:
$dir='../less/variables.json'; if(file_exists($dir)) { if(unlink($dir)) print "el archivo fue borrado"; } else print "este archivo no existe"; $json = file_get_contents("php://input"); $file = fopen($dir,'w+'); fwrite($file, $json); fclose($file);
i have form input touring not send data angular form ...
i need create json.php urlwing pass in array generated angularjs
<?php $mydata = json_decode($_post['datas']); print_r($mydata); if(file_get_contents("php://input")){ $json = file_get_contents("php://input"); $file = fopen($dir,'w+'); fwrite($file, $json); fclose($file); } ?>
Comments
Post a Comment