即使不是特殊字符,某些单词也不会显示在 PHP 中

Even though not special characters some of the words not displaying in PHP

我有一个奇怪的问题,我正在通过 Xammp 服务器从 SQL 服务器检索数据并通过浏览器显示在 PHP 中(通过 json 输出),所以一些我想在浏览器中显示的字符串有描述,例如

"**Delightfully warmingour butterysweet tart crusts are filled with delicious fillings Try the lemontart for a slice of sweet and tangy flavour**" 

还有另一个例子

" **Richwarm and homemadeour chocolate brownie has a fudgy inside and a crisp chocolaty outside  served with a scoop of VANILLA ICE CREAM Rs 430**" 

当我通过 PHP 从数据库中检索时,没有在浏览器中显示,如您所见,没有特殊字符(逗号“,”除外),但即使带有“,”显示在一些描述中,但特别是上述两个示例未显示在浏览器中。

我不明白为什么,这很奇怪,谁能帮我解决这个问题,在这方面的帮助将不胜感激,

PHP代码如下:

<?php
    //require_once(dirname(__FILE__).'/connectionInfoTest.php');
    require_once(dirname(__FILE__).'/connectionInfoTestNew.php');

{
    //Set up our connection
    $connectionInfo = new ConnectionInfo();
    $connectionInfo->GetConnection();

    if (!$connectionInfo->conn) {
        //Connection failed
        echo 'No Connection';
    } else {

        $query = " SELECT i.itemid as fir_ID,i.name as fir_name,
                    i.code, i.itemdescription,i.unitprice,i.isservicecharge,
                    i.costprice,i.itemgroupid,i.image,c2.name as sec_name 
                    FROM vw_app_item i 
                        inner join itemlayer1 c1 on i.itemlayer1id = c1.itemlayer1id 
                        inner join itemlayer2 c2 on i.itemlayer2id=c2.itemlayer2id 
                    WHERE c2.name in ('ICED TEA','BLACK TEA','MOCKKTAIL',
                                        'SPARKLING TEA','T-SHAKES','SMOOTHIE',
                                        'WATTE','BRUSCHETTA','BRUSCHETTA','CREPE',
                                        'BURGER','DESSERT','ICE CREAM',
                                        'PIZZA','TOASTIE','WAFFLE','WRAP','TACO') 
                    order by c1.name,c2.name";  // query to check the all the categories


        $stmt = sqlsrv_query($connectionInfo->conn, $query);

        if (!$stmt)
        {
            //Query failed
            echo 'Query failed';
        } else {
            $contacts = array(); //Create an array to hold all of the contacts
            //Query successful, begin putting each contact into an array of contacts

            while ($row = sqlsrv_fetch_array($stmt,SQLSRV_FETCH_ASSOC)) //While there are still contacts
            {
                //Create an associative array to hold the current contact
                //the names must match exactly the property names in the contact class in our C# code.
                $contact= array("ID" => $row['fir_ID'],
                                 "Category" => $row['sec_name'],
                                 "Name" => $row['fir_name'],
                                 "Code" => $row['code'],
                                 "Description" => $row['itemdescription'],
                                 "Price" => $row['unitprice'],
                                 "isservicecharge" => $row['isservicecharge'],
                                 "CostPrice" => $row['costprice'],
                                 "Date" => $row['itemgroupid'],                              
                                 "Image" => base64_encode($row['image'])                                                                                                 
                                 );                                  
                //Add the contact to the contacts array
                array_push($contacts, $contact);
            }

            //Echo out the contacts array in JSON format
            header('Content-type: application/json');
            $output = ['Resturent' => $contacts];
            echo json_encode($output, JSON_PRETTY_PRINT);
        }
    }
}
?>

其实这个问题是由项目源中的空格引起的,就数据库而言,数据库中的数据应该在中间没有空格的情况下存储