我想要從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