我想要从serice页面到php页面的多个值。我想将'data','albimg','albvideo'传递给php page.now我发现错误是如图所示。 从js页面传递多个值到php页面
var deferred = $q.defer();
data.pagename = "create_album";
$http.post('js/data/album.php', {action:{"data":data,"albimg":albimg,"albvideo":albvideo}})
.success(function (data, status, headers, config)
{
console.log(status + ' - ' + action);
deferred.resolve(action);
})
.error(function (action, status, headers, config)
{
deferred.reject(action);
console.log('error');
});
return deferred.promise;
php page:
$postdata = file_get_contents("php://input",true);
$request = json_decode($postdata);
$now = date('Y-m-d H:i:s');
echo $sql="INSERT INTO `$prefix.album` (CONTENT_VALUES,CreatedTime)VALUES('$postdata','$now')";
行动。上面的代码,行动不是一个变量,(是一个属性) – Ray