随机选择带有定义变量的集合

时间:2015-06-03 16:28:59

标签: php arrays multidimensional-array

我正在努力完成以下任务:

  1. 定义多组变量
  2. 使用PHP随机选择一组
  3. 从整个页面中选择的集合中回显数据
  4. 以下是具有虚拟变量和数据的逻辑示例:

    ---定义每个设定---

    SET 1 {
    title1 = Sample School
    text1 = School is great
    link1 = school-page.php
    }
    
    SET 2 {
    title2 = Sample Business
    text2 = Business is great
    link2 = biz-page.php
    }
    
    SET 3 {
    title3 = Sample Organization
    text2 = Organization is great
    link3 = org-page.php
    }
    

    ---在页面中选择SET的输出变量---

    <h1><?php echo $title(from selected set) ?></h2>
    <p><?php echo $text(from selected set) ?></p>
    <div>Visit page <a href="<?php echo $link(from selected set) ?>">here</a></div>
    

0 个答案:

没有答案