Home > php教程 > php手册 > body text

写了个以交替背景色显示输出的函数,只有三行。。。呵呵。。。

WBOY
Release: 2016-06-21 09:07:31
Original
1071 people have browsed it

函数|显示

// change the background color of your out put result
function bgColor($foo,$ColorOne="#ffffff",$ColorTwo="#eeeeee")  {
      $bgcolor = $ColorOne;
      $foo % 2  ? 0: $bgcolor = $ColorTwo;
      return $bgcolor;
}
可以自己设置背景色,调用函数时传入参数即可;
也可用缺省值;

使用范例片段:
echo "

";
for ($i=0;$inum_rows();;$i++)  {
     $q->next_record();
     echo "
";
     ....................



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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template