您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

PHP mySql数据到JSON文件

PHP mySql数据到JSON文件

您可以使用json_encode功能

以下是示例代码

$result = MysqL_query(your sql here);    
$data = array();
while ($row = MysqL_fetch_assoc($result)) {
    // Generate the output in desired format
    $data = array(
        'cols' => ....
        'rows' => ....
        'p' => ...
    );
}

$json_data = json_encode($data);
file_put_contents('your_json_file.json', $json_data);
php 2022/1/1 18:40:07 有301人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶