如果更优雅,有没有更有效的方法来做到这一点?

there is better way to do this? A more efficient or elegant in PHP? Like an SQL IN ?

This is the code

if ($rol == 1 || $rol == 2 || $rol == 3 || $rol == 5 || $rol == 6 || $rol == 8 ) { 

Put your numbers in array then use in_array PHP function:

$array = array(1,2,3,4,5,6,8);
if(in_array($rol, $array, true))
{
//Yaay we got a hit ! 
}