首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >得到?标记为来自php的响应,而不是获取Tamil文本字符串。

得到?标记为来自php的响应,而不是获取Tamil文本字符串。
EN

Stack Overflow用户
提问于 2017-05-04 14:48:52
回答 1查看 151关注 0票数 1

我在表中有泰米尔语文本,当我使用PHP检索数据时,我得到了?作为回应。

下面是我的PHP代码。

代码语言:javascript
复制
    <?php 
header( 'Content-Type: text/html; charset=utf-8' );
include('connection.php');

$query = "SELECT * FROM DevotionalCollection";
$fetch=mysqli_query($con, $query ) or die(mysqli_error($con));

if (mysqli_num_rows($fetch) > 0) {
    $response["data"] = array();
    while ($row = mysqli_fetch_array($fetch)) {

        $data = array();
        $data["playlistname"] = $row["playlistname"];
        $data["playlistid"] = $row["playlistid"];
        $data["channelname"] = $row["channelname"];
        $data["imageURL"] = $row["imageURL"];

        //$response["data"] = array();
        array_push($response["data"], $data);

    }
    header('Content-type: text/json');
    $response["success"] = TRUE;
    // echoing JSON response
    echo json_encode($response);
}else {
    // no products found
    $response["success"] = FALSE;
    $response["message"] = "No data found";

    // echo no users JSON
    echo json_encode($response);
}

?>

我得到的回应是

代码语言:javascript
复制
    {
  "data": [
    {
      "playlistname": "?????",
      "playlistid": "PLfLdj4WW-kHU4f4CGm2F9vG--ggvcy7PD",
      "channelname": "Lalitha Lalli",
      "imageURL": ""
    },
    {
      "playlistname": "Colour kolam. ???? ????????. Colour muggulu. Rangoli designs",
      "playlistid": "PLBYk4p11EVuoay-_RpW1x4f6N2eaE6rOO",
      "channelname": "TD Kolam",
      "imageURL": ""
    },
    {
      "playlistname": "Easy Rangoli. ????????. Muggulu",
      "playlistid": "PLBYk4p11EVuqkpL3gwAK2uDZfzyoLM5vW",
      "channelname": "TD Kolam",
      "imageURL": ""
    },
    {
      "playlistname": "?????",
      "playlistid": "PL7PWXzhNZZ0QRVUHZkouHO-Z6ONhPlejT",
      "channelname": "Sumathy G",
      "imageURL": ""
    },
    {
      "playlistname": "?????",
      "playlistid": "PLajt0f8unQ6XqkA_y41ypby_0_9lTf6s_",
      "channelname": "Selvamani Jayabal",
      "imageURL": ""
    },
    {
      "playlistname": "???????????? ???????",
      "playlistid": "PL_wM35e-Czjnzsa-97-IFOmEhOWIrJn1C",
      "channelname": "A to Z Nandhini",
      "imageURL": ""
    },
    {
      "playlistname": "Chikku kolangal",
      "playlistid": "PLSll0nWLklOE9i26_A8-wMHYM91ls-j_p",
      "channelname": "Dr.B.Selvamuthu Krishnan",
      "imageURL": ""
    },
    {
      "playlistname": "Pink",
      "playlistid": "PL-u817lYZC9GXncSo4pnnOp6EG0L-cuCk",
      "channelname": "jagan sekar",
      "imageURL": ""
    },
    {
      "playlistname": "Sk",
      "playlistid": "PLa7cnEZgdw5SH7ZMZENjF650Vv8CDY93L",
      "channelname": "Suresh Kalai",
      "imageURL": ""
    },
    {
      "playlistname": "Popular Videos - Kolam & Puja",
      "playlistid": "PL_ZkVSTePDMvkw9c6CLMCqxc7GlqD3EDU",
      "channelname": "Kolam - Topic",
      "imageURL": ""
    },
    {
      "playlistname": "Rangoli Design-Kolam Design",
      "playlistid": "PLFpOXrFtpgWhqGOQad3PdRZ-QUrBkOZ8l",
      "channelname": "Nagu's Handwork",
      "imageURL": ""
    },
    {
      "playlistname": "Kolam",
      "playlistid": "PLhSkx3hNgucQiXYpgrIZzcBSrBVr7Rr0D",
      "channelname": "Jamuna Rani",
      "imageURL": ""
    },
    {
      "playlistname": "Kambi kolam",
      "playlistid": "PLybpr3Tk6SmVFQ7QolQ2Pt45KbTu9IQKp",
      "channelname": "Balasubramanian Krishnamurthy",
      "imageURL": ""
    },
    {
      "playlistname": "Rangoli borders. kolam border. muggulu border",
      "playlistid": "PLBYk4p11EVupclfP6C4RbjHBu-9ylr1q9",
      "channelname": "TD Kolam",
      "imageURL": ""
    },
    {
      "playlistname": "CHIKKU KOLAM",
      "playlistid": "PLfvmbqiPYkkpuLW8psUOVz-kLCRu2EZcE",
      "channelname": "thilagalakshmi sridharan",
      "imageURL": ""
    },
    {
      "playlistname": "Popular Rangoli & Kolam videos",
      "playlistid": "PLxE-NIHKNadzvjuVu_EoKHHDbvunPzmJ2",
      "channelname": "Rangoli - Topic",
      "imageURL": ""
    },
    {
      "playlistname": "Popular Videos - Rangoli & Peafowl",
      "playlistid": "PLxE-NIHKNadxA5IAylBprcVUPYJNHaPaK",
      "channelname": "Rangoli - Topic",
      "imageURL": ""
    },
    {
      "playlistname": "Popular Thai Pongal & Kolam videos",
      "playlistid": "PLcIFZKKK5Ex29vy7lbWKbFstgoeG1XNCP",
      "channelname": "Thai Pongal - Topic",
      "imageURL": ""
    },
    {
      "playlistname": "aanmeegam / ????????",
      "playlistid": "PLCR_lidRFmjCnNhVRCRTENHZ360ySzTHH",
      "channelname": "Zio Tamil",
      "imageURL": ""
    },
    {
      "playlistname": "kolangal",
      "playlistid": "PL3CPcT90G7vPDD5Iw1A5FLNEMA_RXSoHY",
      "channelname": "LEARNGOODALL",
      "imageURL": ""
    },
    {
      "playlistname": "108 simple Diwali kolam designs ( 4 to 9 dots ) | an easy rangoli a day to learn for Diwali decoration ideas | simple New Year rangoli",
      "playlistid": "PLwHuVZQFx6IhZ-8HtC5umsnyNxFGGwfXt",
      "channelname": "Sudha Balaji",
      "imageURL": ""
    }
  ],
  "success": true
}

任何人都可以帮助解决这个错误。提前谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-05-04 15:14:43

  1. 在连接中检查字符集:(宁愿将它放在connection.php中)

标题(‘内容-类型: text/html;charset=utf-8’);包含(‘connection.php’);//将字符集设置为utf8 mysqli_set_charset($con,"utf8");$query = "SELECT * FROM DevotionalCollection";$fetch=mysqli_query($con,$query )或die(mysqli_error($con));if (mysqli_num_rows($fetch) > 0) { $response"data“= array();while ($row = mysqli_fetch_array($fetch)) { $data = array();$data"playlistname“= $row"playlistname";$data"playlistid”= $row"playlistid";$data"channelname“= $row"channelname";$data"imageURL”= $row"imageURL";//$response"data“=$row();array_push($response"data",$data);}头(‘Content-type: text/ JSON ');$response"success“= TRUE;//回显JSON响应回波json_encode($response);}$response{ // no产品发现$response”成功“= FALSE;$response消息”=“没有找到数据”;//回声没有用户JSON回送json_encode($response);} ?>

  1. 更改数据库中的字符集: 修改数据库DBNAME字符集utf8整理utf8_general_ci;
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43786172

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档