PHP echo 在回显较长的字符串时无法给出输出


PHP echo fails to give output when a longer string is echoed

我正在PHP中实现关键字搜索。当没有。来自数据库的结果大于 264 PHP echo 无法给出任何输出。知道这里可能有什么问题吗?

// my algo is -
 $result = mysql_query(searchQueryString) or die(mysql_error());
 $row = mysql_fetch_assoc($result);
//Create a $json_array of required values
$str_to_print = json_encode($json_array);
echo $str_to_print;//this gives empty output when no. of rows from DB > 264
//Everything else is working properlycode here

原谅这一点,我想发表评论,但由于代表而无法发表评论。

我使用了这个语句:print json_encode(array(1, 2, 3, 4, 5));,得到的结果是:[1,2,3,4,5]

要么你从mysql_query的结果是错误的,要么是别的什么。

刚刚注意到,您正在使用以下代码行:

$str_to_print = json_encode($json_array);

但是$json_array设置在哪里?是完全设置还是将空指针传递给函数?错误:注意:未定义的变量:json_array