JS+PHP瀑布流效果
miai.php,代码如下:
$link = mysql_connect("localhost","root","");
//连接数据库
$num = 0 *3;//分页
if(isset($_POST['num']) && $_POST['num'] != 0)
$num +1;
else
$num = 0;
$sql = "select id,image from liu.miai limit ".$num.",3";//分条
$result = mysql_query($sql,$link);
$json_arr = array();
while($row = mysql_fetch_array($result)){
$json_arr[] = (object)$row;
}
echo json_encode($json_arr);