Easiest way to alternate row colors in PHP/HTML?

前端 未结 19 1960
無奈伤痛
無奈伤痛 2020-12-01 03:41

Here\'s a PHP example of mine. Can anyone find a shorter/easier way to do this?


    
19条回答
  •  情书的邮戳
    2020-12-01 04:20

    It's short enough as it is, but I would probably wrap it into some helper function with a clear name. That way it's more obvious what's going on and you won't have to repeat that logic in all templates where you need it.

提交回复
热议问题