如何用数组去接受这一系列参数?
用jquery异步向B页面传递一系列参数:
$.get('get.php?a="+ Math.random()', {name: $(this).val()}, function(data) {
alert(unescape(data));
});
其中$(this).val()为一组数据,其值为1,2,3,4 通过jquery 的$.get方法向B页面传这组数据,如何在B页面用数组接收这组数据并用数组的索引显示出来,比如echo $name[1]就可以打印出2。
------解决方案--------------------
$_GET['name'] = '1,2,3,4';
$arr = explode(',', $_GET['name']);
print_r($arr);
//输出结果
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
)
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号