把一个索引数组内的某个元素删除后直接转成json输出,数据格式不正确

admin4年前php898

可以看到数组格式在unset后发生变化 解决方法很简单 仅一行代码就可以解决
在foreach后 增加
$arr = array_values($arr);


转至:https://blog.csdn.net/tingting0805/article/details/72974431

相关文章

php.ini 7.3设置

date.timezone = PRCdisplay_errors = On网络保存图片,以及微信获取手机号码: windows下的PHP,只需要到php.ini中把前面的&nb...

php post undefined index,PHP 中提示undefined index的解决方案

声明为空isset($_POST['user_email']),或者,empty($_POST['user_email'])在php.ini中设置error_repor...

php过滤emod与特殊字符

<?php  function xml_entities($string) { //过滤emod $ts_zifu= json_encode($st...

php下载地址

https://windows.php.net/downloads/releases/archives/...

mysql批量添加数据

$conn=new sqlhelper;for ($i = 0; $i <1000 ; $i++) {$sql="insert into system_user(user_shenfe...

php的function函数内部只能有一个return

php的function函数内部只能有一个return,之后的代码就都全部运行不正常了...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。