在php中获取 数据库的内容,返回到页面

<?php
header("content-type:text/html;charset=utf-8");
$link=mysqli_connect("localhost","root","root","d5");
mysqli_set_charset($link,"utf8");
$query="select * from one";
$p=mysqli_query($link,$query);
print_r(json_encode(mysqli_fetch_all($p)));
mysqli_close($link);
?>
posted on 2019-05-24 16:39  Web引领者  阅读(1025)  评论(0编辑  收藏  举报