【发布时间】:2018-10-02 12:45:18
【问题描述】:
内容我的控制器:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class AutoLoadDiv extends CI_Controller {
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->view('ngoding/AutoLoad');
}
public function getData() {
$this->load->library('table');
$err = file_get_contents("application\logs\log.php");
$filestr = preg_replace(array('/(^|\R)ERROR\s*-\s*/', '/(^|\R)(.*?)\s*-->\s*/'), array('$1', '$1$2 '), $err);
$arraySpacing = nl2br($filestr);
$arr = explode("\n", $arraySpacing);
$output = '<table style="tr:nth-child(even){background-color#FFF;} tr:nth-child(odd){background-color:#CCC;}", border="1px solid #dddddd;" >';
for ($i = count($arr)-1; $i >= 0; $i--) {
$output.="<tr><td>$arr[$i]</td></tr>";
}
$output.="</table>";
echo $output;
}
}
我有问题添加颜色背景每一行是不同的行,我找到了我的答案但没有工作,答案是在tr:nth-child(even)和tr:nth-child(odd)中添加代码,如何在标签中添加tr:nth-child(even)和tr:nth-child(odd) ?
【问题讨论】:
-
无法在控制器中添加标签
-
ok 谢谢你,现在工作
-
你的评论不能投票
-
为什么我要举报你的评论,你的评论没有违反
标签: php html css codeigniter