gpt4 book ai didi

php - 获得空响应,如果存在 blob 字段 [PHP]

转载 作者:行者123 更新时间:2023-11-29 02:55:24 24 4
gpt4 key购买 nike

我一直在通过 php 从 mysqli 数据库中检索数据。

$query = "SELECT id, parentId, firstName, middleName, lastName, mobileNumber, photo FROM person WHERE orgId='".$orgId."' ";

$sql = mysqli_query($con, $query);
$data=array();
if($rows_count!=0){
while ($rows_fetch = mysqli_fetch_assoc($sql))
{
var_dump($rows_fetch);
$info = $rows_fetch;
array_push($data, $info);
$isSuccessful = true;
$code = 200;
}
}else{
$isSuccessful = true;
$code = 202;
}

$response = array("resp"=>$data, "code"=>$code, "isSuccessful"=>$isSuccessful);

如果 blob 字段为空,我将收到响应。如果有 blob,我得到的是空响应

最佳答案

while ($rows_fetch = mysqli_fetch_assoc($sql))
{
//var_dump($rows_fetch);
$info = $rows_fetch;
$info['photo'] = base64_encode($rows_fetch['photo']);
array_push($data, $info);
$isSuccessful = true;
$code = 200;
}

我已将 blob 更改为 base64 代码。

关于php - 获得空响应,如果存在 blob 字段 [PHP],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31176842/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com