为什么 Json_encode 返回 NULL?帮帮我

问题描述 投票:0回答:0
<?php
           require "dbCon.php";
       
           $qr = "SELECT * FROM cameras";
       
           $ds = mysqli_query($con, $qr);
       
           $arrCam = array();
       
           while ($row = mysqli_fetch_array($ds)){
               //echo $row['name'];
               array_push ($arrCam, new DsCam(
                   $row["id"],
                   $row["name"],
                   $row["link"]
               ));
           }
       
           echo json_encode($arrCam);
       ?>

这是页面上回显的内容:

[{"key":null,"CamName":null,"RTSP":null},{"key":null,"CamName":null,"RTSP":null},{"key":null,"CamName":null,"RTSP":null}]
php arrays mysqli apple-push-notifications jsonencoder
© www.soinside.com 2019 - 2024. All rights reserved.