protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
viewPager = (ViewPager) findViewById(R.id.viewpager);
setupViewPager(viewPager);
tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
//Some other code
}
我确信这是一个基本问题,谷歌搜索这是一场噩梦。
“?0:”是什么意思?
答案 0 :(得分:1)
它被称为ternary operator,它本质上是一个简短的if()
声明。
你基本上说:
if(empty($_SESSION['userauthorized'])) {
$userauthorized = 0;
} else {
$userauthorized = $_SESSION['userauthorized'];
}