Home > Backend Development > PHP Tutorial > 每一次打开页面随机运作一段代码。其他几段不运行的代码

每一次打开页面随机运作一段代码。其他几段不运行的代码

WBOY
Release: 2016-06-13 13:19:39
Original
899 people have browsed it

每一次打开页面随机运行一段代码。其他几段不运行的代码,
每一次打开页面随机运行一段代码。其他几段不运行代码

用户打开网站

显示几个广告代码中的一个

打开另外一个页面

再次显示另外一段广告代码。求代码

------解决方案--------------------

PHP code

$rd = rand(0,5);

switch($rd){
case 1:
    echo "1111";
    break;
case 2:
    echo "2222";
    break;
case 3:
echo "3333";
case 4:
    echo "4444";
    break;

default:
    echo "sorry";
    break;
} <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
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