2016-05-24 65 views
1

在Explore.php頁面上,我需要顯示Instagram用戶名和個人資料圖片,關注者和我使用Instagram.php頁面使用JSON來獲取數據。我在Instagram.php中添加了各種功能來獲取Instagram用戶的關注者,喜歡,生物,媒體。我如何增加在PHP中獲取Instagram數據

在Explore.php我用下面的代碼以HTML表格打印數據

$query = "SELECT * FROM ig_accounts WHERE confirmed = 1 LIMIT $limit, $rows_per_page"; 
$run_query = mysqli_query($conn, $query); 
while($rows = mysqli_fetch_assoc($run_query)) 
{ 
$user_name = $rows['username']; 
?> 
<tr> 
<td><img src="<?php echo profile_pic($user_name); ?>" width="30" height="30" class="img-circle"><a href="accounts.php?username=<?php echo $user_name?>">@<?php echo $user_name; ?> </a></td> 
<td> <?php echo (followers($user_name))/1000; echo "k"; ?></td> 
<td> $<?php echo $rows['account_amount']; ?> </td> 
</tr> 
<?php 
} 

此代碼的工作,但時間太長處理和打印Explore.php頁上的數據,有時我由於超時而導致500內部服務器錯誤。 反正有沒有提高代碼的處理?

回答

0

您可以在php.ini文件中增加timout限制。

upload_max_filesize = 2M 
; or whatever size you want 

max_execution_time = 60 
; also, higher if you must - sets the maximum time in seconds 

您也可以使用分頁或使用無限滾動。你可以谷歌它有很多教程。

+0

我已經添加了upload_max_filesize = 12M,並且在瀏覽頁面上也出現了分頁,我想要的是提高執行速度而不是超時它:)非常感謝。感謝你的幫助 – shobhit99