我有一个表格,网址是这样的:
http://hostname/projectname/classname/methodname/variablename
在我的 JavaScript 中,我填充了一个这样的数组:
var currentrelations = new Array();
$(".ioAddRelation").each(function(index) {
currentrelations[index] = $(this).html();
});
这个数组有两个值['eeeeee','eeeeee']
所以网址是:
http://localhost/Mar7ba/InformationObject/addIO/eeeeee,eeeeee
在我的 PHP 中,在 InformationObject 类中,在方法 addIO 上:
public function addIO($currentRelations =null) {
$name = $_POST['name'];
$type = $_POST['type'];
$concept = $_POST['concept'];
$contents = $_POST['contents'];
$this->model->addIO($name, $type, $concept, $contents);
if (isset($_POST['otherIOs'])) {
$otherIOs = $_POST['otherIOs'];
$this->model->addOtherIOs($name, $otherIOs);
}
$NumArguments = func_num_args();
if ($currentRelations!=null) {
$IOs = $_POST['concetedIOs'];
$this->model->setIoRelations($name,$IOs, $currentRelations);
}
exit;
include_once 'Successful.php';
$s = new Successful();
$s->index("you add the io good");
}
$currentRelations
但是当我使用这个语句打印数组时:
echo count($currentRelations)
结果是1 not 2
,当我使用 thie 语句打印第一个元素时,echo $currentRelations[0]
我得到e not eeeeee
这是为什么?解决办法是什么?我究竟做错了什么?