I would go a AngularJS array with PHP -


i have these data:

controller.js (angularjs)

datas = {     'variable' : $scope.variables, };  $http.post('http://localhost/proyectos/3.0copy/app/partials/createjson.php', datas).then(function() {     console.log(datas); }); 

array log google chrome

i use http send me these variables create json.php array , try print me everything. have this:

createjson.php

<?php         $datos = $request->datas;     echo $datos;      $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, $email);       fclose($file);     } ?> 

i not return anything, generated file empty.

<?php    $dir='../less/variables.json';  if(file_exists($dir))  {  if(unlink($dir))  print "el archivo fue borrado";  }  else  print "este archivo no existe";   $datos = $request->datas; echo $datos;  $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) -