Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在页面中并排对齐列表数据_Php_Wordpress - Fatal编程技术网

Php 如何在页面中并排对齐列表数据

Php 如何在页面中并排对齐列表数据,php,wordpress,Php,Wordpress,我正试图像这样排列数据列表 但我得到这样的输出 我尝试了以下代码 $rawResult = unserialize($rawResult->sections); $ans = array(0,1,2,3,4,5); foreach ($rawResult as $questionKey => $questionArray) { foreach ($questionArray['answers'] as $key => $value) { if(in_array(

我正试图像这样排列数据列表

但我得到这样的输出

我尝试了以下代码

$rawResult = unserialize($rawResult->sections);
$ans = array(0,1,2,3,4,5);
foreach ($rawResult as $questionKey => $questionArray) {
  foreach ($questionArray['answers'] as $key => $value) {
    if(in_array($value['given'][0], $ans)){
    $answers[$key] = $value['given'][0];
  }
  }
  foreach ($questionArray['questions'] as $id => $val) {
    if (!preg_match("/How stressful has it been/i", $val['name'])) {
    /*if($val['type'] == 'Single'){*/
      $questions[$val['id']] = $val['name'];
    }
  }
}
ob_start();
global $csa_answers;
asort($answers);
$i=0;
$m=0;
$l=0;
$y=0;
global $pdf;

?>
<table class="progress-bar-container assessment-result" style="text-align:center;">
      <tr>
        <td><h3 style="font-weight: 700;font-size: 25px;line-height: 32px;color: #000;margin-bottom: 6px;font-family: 'Karla';">CSA Questions/Ratings</h3></td>
      </tr>
       <tr>
        <td><span style="text-align: center;">Every CSA question and your response is listed below. Each question started out with the phrase,<br>
"How much have you been stressed by.....?"</span></td>
      </tr>
      </table>

        <table class="table table-striped table-bordered" style="text-align:left;" width="620">

          <tr>
            <td><table width="310"><tr>
            <td width="225" style="background-color: #EAE9E8;font-size:12px;">QUESTION</td>
            <td width="80" style="background-color: #EAE9E8;font-size:12px;">RATING</td>
            </tr>
            <tr>
          <?php foreach ($answers as $id => $ans) {
            if(isset($questions[$id])){
              $i++; ?>
              <td style="<?php echo $c;?>"><span style="font-size:10px;"><?php echo str_replace('How much have you been stressed by ','',stripslashes($questions[$id]));?></span></td>
              <td style="<?php echo $c;?>"><span style="font-size:10px;"><i><?php echo $csa_answers[$ans];?></i></span></td>
              <?php
                if ($l==0) {
                  $c= "background-color: #EAE9E8;";
                  $l++;
                }
                else{
                  $c="";
                  $l=0;

                }
                $i = 0;
                $m++;
              echo "</tr><tr >";

              $y++;
              if ($y==34) {
                $l==0;
                echo '<td></td><td></td></tr></table></td><td ><table width="310"><tr>
            <td width="225" style="background-color: #EAE9E8;font-size:12px;">Question</td>
            <td width="80" style="background-color: #EAE9E8;font-size:12px;">Rating</td>
            </tr><tr>';
              }

            }
          }
          ?>
      <td></td><td></td></tr></table></td></tr><tr>
<?php echo '<td colspan="2" style="text-align:center;"><span class="score-desc" style="font-size:9px;">The choices for answering each question were:</span><br>
        <span class="csmith-right-margin" style="font-size:9px;"> Not at all (Stress Free) </span>
        <span class="csmith-right-margin" style="font-size:9px;"> A little bit </span>
        <span class="csmith-right-margin" style="font-size:9px;"> Moderately </span>
        <span class="csmith-right-margin" style="font-size:9px;"> Quite a bit </span>
        <span class="csmith-right-margin" style="font-size:9px;"> Extremely </span>
        <span class="csmith-right-margin" style="font-size:9px;"> Does not apply  </span></td></tr>';
           ?>
    </table>
    <?php
  $content = ob_get_clean();
  return $content;
$rawResult=unserialize($rawResult->sections);
$ans=数组(0,1,2,3,4,5);
foreach($rawResult作为$questionKey=>$questionArray){
foreach($questionArray['answers']作为$key=>$value){
if(在数组中($value['given'][0],$ans)){
$answers[$key]=$value['given'][0];
}
}
foreach($questionArray['questions']作为$id=>$val){
如果(!preg_match(“/How stressful have/i”,$val['name'])){
/*如果($val['type']=='Single'){*/
$questions[$val['id']=$val['name'];
}
}
}
ob_start();
全球$csa_答案;
asort($答案);
$i=0;
$m=0;
$l=0;
$y=0;
全球$pdf;
?>
CSA问题/评分
下面列出了每个CSA问题和您的回答。每个问题都以短语开头,
“你的压力有多大……” 问题: 评级
表不适用于此,您可以使用:

  1. <div style='display:inline-block'>Column 1</div> <div style='display:inline-block'>Column 2</div>
 2. Use css flex box (prefer for responsive page reason).
 3. Or if you familiar with table use <div style='display:table'></div> as css table not HTML table
1.第1列第2列
2.使用css flex box(出于响应页面的原因,首选)。
3.或者如果您熟悉表格,请使用css表格而不是HTML表格

表格不适用于此,您可以使用:

  1. <div style='display:inline-block'>Column 1</div> <div style='display:inline-block'>Column 2</div>
 2. Use css flex box (prefer for responsive page reason).
 3. Or if you familiar with table use <div style='display:table'></div> as css table not HTML table
1.第1列第2列
2.使用css flex box(出于响应页面的原因,首选)。
3.或者如果您熟悉表格,请使用css表格而不是HTML表格

您到底想完成什么?两栏视图?如果是,请编辑您的问题,并说明您想复制示例的哪一部分。您到底想完成什么?两栏视图?如果是,请编辑您的问题,并说明您想复制示例的哪一部分