飞飞返回数组-json

2025-3-26 / 0 评论 / 3 阅读

<?php
\$type=\$_REQUEST["type"];//查询数据关键字
\$ym=\$_REQUEST["ym"];//起妈
\$zm=\$_REQUEST["zm"];//显示条数
\$conn=mysqli_connect("localhost","435000","密码","435000");
// 连接数据库user
if (!\$conn) {

code...判断链接是否成功

echo "连接失败!"; 
echo mysqli\_connect\_error(); 
exit(); 

}
mysqli_query(\$conn,"set names utf8");
// 指定编码格式
\$sql="SELECT vod_id,vod_name,vod_pic,vod_area,vod_year FROM `ff_vod` WHERE `vod_cid` = \$type ORDER BY `vod_addtime` DESC limit \$ym,\$zm";
// sql语句
\$result=mysqli_query(\$conn,\$sql);
while (\$row=\$result->fetch_assoc())
{
echo "

";
print_r(json_encode(\$row));
//echo "---";
}
?>