逐个包含两个文件,比例为4:1

Mas*_*Mas 0 php

我有两个文件file4.php和file1.php

使用INCLUDE如何将它们放在一个比率中,如果file4.php显示4次,则file1.php应显示1次,比例为4:1.什么是最佳做法?

<?php 
  {
    include("file4.php");

} else {

    include("file1.php");
  }
?>
Run Code Online (Sandbox Code Playgroud)

Sup*_*Dud 7

这将显示随时间推移的两个页面中的一个,包括file4,比例为4比1. http://en.wikipedia.org/wiki/Law_of_large_numbers

$randInt = rand (1, 5);

if ($randInt > 1) include("file4.php");
else include("file1.php");
Run Code Online (Sandbox Code Playgroud)