<?php
header("Content-type: text/html; charset=utf-8");
$host = '数据库IP';
$dbname = '数据库名称';
$user = '用户名';
$pw = '密码';
$pdo = new PDO("mysql:host=".$host.";dbname=".$dbname."",$user,$pw); //通过PDO连接数据库
$sql = 'SELECT * FROM `新闻表` WHERE 1 ';
$arr = $pdo->query($sql)->fetchall();
echo json_decode($arr); //输出JSON
?>

最新文章

  1. C#中Validating和Validated事件
  2. SecureCrt设置字符编码
  3. [设计模式] 16 迭代器模式 Iterator Pattern
  4. Windows下Redis中RedisQFork位置调整
  5. mariadb 设置远程访问
  6. PHP XML简介
  7. eclipse开发安卓时logcat的绿色加号不见了
  8. IPv4 forwarding is disabled. Networking will not work_问题解决
  9. Swift PlayGround无限Running问题
  10. spring cloud 学习笔记(1)
  11. [Swift]LeetCode840. 矩阵中的幻方 | Magic Squares In Grid
  12. CentOS 7 yum install cobbler2.8.3
  13. jenkins忘记管理员密码之解决方案
  14. 《了不起的 nodejs》中 TwitterWeb 案例 bug 解决
  15. CentOS 安装Python3、pip3
  16. EasyUI出现多条边框重合的问题
  17. HTML5 &amp; auto download image
  18. Visual Studio 2017 版本 15.5.5
  19. 硬盘读取不了--&gt;&gt;完美解决
  20. 创建pod步骤

热门文章

  1. js substr和substring
  2. Windows 环境下 wampserver 与 phpStudy 的环境配置
  3. hibernate的merge()
  4. 3 Oracle 32位客户端安装及arcgis连接
  5. Java设计模式系列 — 构造器模式
  6. Broadcast
  7. day18 十八、random、shutil、shevle、logging
  8. 洛谷P3376 【模板】网络最大流
  9. 安装配置Spark集群
  10. 更新Xcode10与iOS12 遇到的bug:library not found for -lstdc++.6.0.9