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.

console angular js chrome

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

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -