我有一個數組在javascript中,我想發佈到PHP存儲到oracle varchar2。我想知道如何在PHP中獲取這個數組。現在我總是有一個字符串[object Object]而不是oracle中的數組。即時通訊使用JQuery $。員額發送變量到PHP這樣的:php oci8取數組var
function savePolygons(){
$.get('oracle_deletePolygons.php');
for (var i = 0; i < createdShapes.length; i++){
var nom_zone = escape(document.getElementById('nom_zone_' + createdShapes[i].id).value);
var couleur = escape(createdShapes[i].fillColor);
var code_cs = escape('711');
var shapeid_export = escape(createdShapes[i].id);
var geometry = createdShapes[i].getPath();
alert(geometry)
var url1 = "oracle_savePolygons.php?nom_zone=" + nom_zone + "&couleur=" + couleur + "&code_cs=" + code_cs + "&shapeid_export=" + shapeid_export + "&geometry=" + geometry;
$.get(url1);
}
}
在PHP中:
<?php
require("oracle_dbinfo.php");
sleep(5);
$nom_zone =$_GET['nom_zone'];
$shapeid_export = $_GET['shapeid_export'];
$code_cs = $_GET['code_cs'];
$couleur = $_GET['couleur'];
$geometry = $_GET['geometry'];
$conn = oci_connect($username, $password, $database);
$query = oci_parse($conn, 'INSERT INTO test1 (nom_zone, shapeid, code_cs, couleur, geometry) VALUES (:nom_zone, :shapeid_export, :code_cs, :couleur, :geometry)');
oci_bind_by_name($query, ":nom_zone", $nom_zone);
oci_bind_by_name($query, ":shapeid_export", $shapeid_export);
oci_bind_by_name($query, ":code_cs", $code_cs);
oci_bind_by_name($query, ":couleur", $couleur);
oci_bind_by_name($query, ":geometry", $geometry);
oci_execute($query);
oci_commit($conn);
?>
了var幾何多邊形的每個頂點的座標的陣列。
爲什麼你使用'$。員額()'那麼你爲什麼要建立一個參數字符串作爲用於獲得? –