Php 未定义偏移量:624
问题是当我添加超过624个贴纸时 当标签小于624时,代码正常工作。它似乎不允许更多的贴纸 我似乎有一个奇怪的错误,我无法纠正 我一直得到的错误是:未定义的偏移量:624 这就是我所拥有的: php:Php 未定义偏移量:624,php,laravel,Php,Laravel,问题是当我添加超过624个贴纸时 当标签小于624时,代码正常工作。它似乎不允许更多的贴纸 我似乎有一个奇怪的错误,我无法纠正 我一直得到的错误是:未定义的偏移量:624 这就是我所拥有的: php: //产品名称 对于($x=0;$xgetUsername($user\u id,$x); } $result=array(); $values=数组($product、$product\U price、$product\U BACKORD、$product\U code、$product\U贴纸)
//产品名称
对于($x=0;$x<$counter;$x++){
$product[]=$\u POST[“产品名称”][$x];
$product_price[]=preg_replace('/\s+/','',$POST[“product_price”][$x]);
$product_BARCABLE[]=预替换('/\s+/','',$后['product_BARCABLE'][$x]);
$product_贴纸[]=preg_替换('/\s+/','',$_POST[“product_贴纸”][$x]);
$vendor\u code[]=$result=$this->getUsername($user\u id,$x);
}
$result=array();
$values=数组($product、$product\U price、$product\U BACKORD、$product\U code、$product\U贴纸);
//$values=数组($product、$product\U price、$product\U BACKORD、$product\U code);
foreach($index=>$key的产品){
$t=数组();
foreach($value作为$value){
$t[]=$value[$index];
}
$result[$key]=$t;
}
$products\U json=json\U encode($result);
html:
@for($x = 0; $x <= 650; $x++)
<tr>
<td><input type="text" name="product_name[]" class="product_name"
value="{{$x}}"></td>
<td><input type="text" name="product_price[]" class="product_price"
value="{{$x}}"></td>
<td><input type="text" name="product_barcode[]"
class="product_barcode"
value="{{$x}}"></td>
<td><input type="text" name="product_stickers[]"
class="product_stickers"
value="{{$x}}"></td>
<td><a role="button" style="color:#fff" class="delRowBtn btn btn-
warning">Remove</a>
</td>
</tr>
@endfor
@对于($x=0;$x可能是您发布了更多的数据,而在php.ini中是允许的,例如,增加post_max_size和max_input_vars.。如果代码中的所有内容都是确定的
在使用之前,请务必检查变量是否存在,尤其是在动态数组中时。
可能的问题:
1.索引从1开始,循环中从0开始
2.在分配之前获取的对象。
但是,
或
在使用前放置条件。为数组生成动态键以消除错误的所有位置。可能是您发布了更多的数据,而php.ini中允许这样做。例如,增加post_max_size和max_input_vars..如果代码中的所有内容都是确定的
在使用之前,请务必检查变量是否存在,尤其是在动态数组中时。
可能的问题:
1.索引从1开始,循环中从0开始
2.在分配之前获取的对象。
但是,
或
使用前放置条件。为数组生成动态键以消除错误的所有位置。可能是您发布的数据比php.ini中允许的数据多。
例如,增加post_max_size
和max_input_vars
这将解决我猜想的问题。可能是您发布的数据比php.ini中允许的数据多
例如,增加post\u max\u size
和max\u input\u vars
这将解决我猜的问题。可能是重复的,可能是您发布的数据比php.ini中允许的数据多。
例如,增加post_max_size
和max_input_vars
这将解决我猜的问题。@DhavalPurohit这是错误,谢谢。请作为答案发布。可能是重复的可能您发布的数据比php.ini中允许的数据多,例如增加post_max_size
和max_input_vars
这将解决我猜想的问题。@DhavalPurohit这是错误,谢谢。请作为答案发布。
@for($x = 0; $x <= 650; $x++)
<tr>
<td><input type="text" name="product_name[]" class="product_name"
value="{{$x}}"></td>
<td><input type="text" name="product_price[]" class="product_price"
value="{{$x}}"></td>
<td><input type="text" name="product_barcode[]"
class="product_barcode"
value="{{$x}}"></td>
<td><input type="text" name="product_stickers[]"
class="product_stickers"
value="{{$x}}"></td>
<td><a role="button" style="color:#fff" class="delRowBtn btn btn-
warning">Remove</a>
</td>
</tr>
@endfor
$product[] = $_POST["product_name"][$x] ?? null;
$product[] = (!empty($_POST["product_name"][$x])) ? $_POST["product_name"][$x] : null;