以下视图代码生成html代码,如下所示。
Q1。第一线做什么?
<?php $ci_uri = trim($this->uri->uri_string(), '/'); $att = ' id="active"';?>Q2。为什么
产生id =“活跃”?
Q3。是什么目的
= substr($ci_uri, 0, 7) == 'example'? $att: ''?>
= $ci_uri == $this->config->item('FAL_login_uri')? $att: ''?>
...
...
= $ci_uri == $this->config->item('FAL_changePassword_uri')? $att: ''?>
etc.它是否使用三元运算符?
查看代码
<?php $ci_uri = trim($this->uri->uri_string(), '/'); $att = ' id="active"';?>
- >=anchor('', 'home')?>
- >=anchor('example', 'examples')?>
- config->item('FAL_login_uri')? $att: ''?>>=anchor($this->config->item('FAL_login_uri'), 'login')?>
- config->item('FAL_register_uri')? $att: ''?>>=anchor($this->config->item('FAL_register_uri'), 'register')?>
- config->item('FAL_forgottenPassword_uri')? $att: ''?>>=anchor($this->config->item('FAL_forgottenPassword_uri'), 'forgotten password')?>
- config->item('FAL_changePassword_uri')? $att: ''?>>=anchor($this->config->item('FAL_changePassword_uri'), 'change password')?>
- >=anchor('admin', 'admin')?>
HTML代码