Home > CMS Tutorial > Empire CMS > Imperial CMS' method to implement efficient random calls

Imperial CMS' method to implement efficient random calls

silencement
Release: 2019-11-26 15:32:22
forward
2964 people have browsed it

Imperial CMS' method to implement efficient random calls

The example in this article describes the method of implementing efficient random calls in Imperial CMS. Share it with everyone for your reference. The specific implementation method is as follows:

The Empire CMS uses ORDER BY RAND() to make random calls, which is the most resource-intensive calling method. If the number of website information is too large, more than 10,000, random calls will affect the website speed.

If you really want to use it, you can use the following idea:

First use php to randomly generate the information ID, and then use SQL to call id in, and php will randomize the ID list.

Calling example:

The code is as follows:

<?php
$randnum=10; //随机数量
$randids=&#39;&#39;;
$randdh=&#39;&#39;;
for($i=1;$i<=$randnum;$i++)
{
$randids.=$randdh.rand(1,100000); //1为最小ID,100000为最大ID
$randdh=&#39;,&#39;;
}
?>
[e:loop={栏目ID,显示条数,操作类型,只显示有标题图片,"id in ($randids)"}]
//模板代码内容
[/e:loop]
Copy after login

Recommended to study "Empire cms tutorial"

I hope this article will be helpful to everyone's Imperial CMS website building help.

The above is the detailed content of Imperial CMS' method to implement efficient random calls. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:www.word666.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template