【发布时间】:2011-03-26 17:18:37
【问题描述】:
PHP 中是否有一个函数或类可以传递 MySQL 记录集并返回一个 JSON 字符串,该字符串可以在 Ajax 请求中传递回 JavaScript 函数?
类似这样的:
function recordSetToJson($recordset) {
while($rs1 = mysql_fetch_row($recordset)) {
for($count = 0; $count < count($rs1); $count++) {
// read and add field to JSON
}
$count++;
}
return $jasonstring
}
【问题讨论】: