<分区> 分区>
我有以下带有几个复杂输入元素的 HTML 表单:
<input type="text" name="images[1]">
<input type="text" name="images[2]">
<input type="text" name="video[1]">
<input type="text" name="video[2]">
当我谈论复杂的输入时,我指的是复杂的元素名称:
name="images[1]"
其中images表示输入的组和[1]输入的编号或标识符。
使用 PHP 处理表单的方法可以实现如下:
if(isset($_POST['images'])) {
foreach($_POST['images'] as $index) { // $key
echo $_POST['images'][$index]; // or key
}
}
如何在 Python 中重现它?
