Home page >> Related Tutorials >>Body

How to Get Call Random Articles in ZBLOGPHP Tutorial

Author: A little Jack    Time: 2022-08-23 16:44:49    Browse: 816   

During the development of Z-BlogPHP program, you need to add a function of obtaining random articles to the site. Many people will use the following code:

 {php}$order = array('rand()'=>'');$ where = array(array('=','log_Status','0')); $array = $zbp->GetArticleList(array('*'),$where,$order,array(10),''); {/php} {foreach $array as $related} <li><a href="{$related.Url}">{$related.Title}</a></li> {/foreach}

However, this is not a good method, because if the number of articles on your website reaches a certain number, this code will directly put your website at risk of collapse!

Because it takes up too much server resources! If your website reaches hundreds of thousands of articles, it is easy to crash and consume service area resources, and the website is also easy to fail to open.

This is one reason why ZBlog does not recommend you to use random article module!

So what's the best way?

Hello, you need to log in to our account to view the hidden content, please first Sign in To view!

The meaning of this code is to randomly use the article time or article visits to sort, obtain 100 articles, and then scramble to obtain them, so that you can save resources in the service area.


Text label: ZBLOG   Random articles  
 A little Jack

A little Jack https://lkba.cn

The blogger focuses on Z-Blog website construction, website optimization, computer troubleshooting, reinstallation, optimization, maintenance system, etc., QQ/WX: 2126245521 (please specify the purpose)

Related articles

Previous:

Next:

No comment for this article - Welcome

 Please fill in the verification code

Processed : 0.047 SQL : 14