PHP中把数据库查询结果输出为json格式简单实例,查询结果json


include/conn.php为数据库链接文件,不会的网上搜索

<?php 
include './include/conn.php'; //数据库链接文件
$sql_notice = mysql_query('SELECT * FROM gg_notice where enable = "1" limit 0,10');
$notice = mysql_fetch_array($sql_notice, MYSQL_ASSOC);
print_r ($notice);
?>


登录后复制

09-11 12:52