Home > Article > Backend Development > Gathering common PHP front-end syntax
php common front-end syntaxCollection
The following is the common front-end php syntax:
// 定义变量 <!--{eval $colSize = sizeof($navlist);}--> <!--{eval $vip_level_points = array(0, 10000, 20000, 35000, 50000, 75000);}-->//数组 <!--{eval $cur_level = $_G[viplevel];}--> // 输出变量 $colSize <!--{eval echo $cur_level + 2;}--> <!--{eval echo $cur_level < 7 ? 'vip-gray' : '';}--> {$item['icon']} // 输出对象值 {$iconColor[$index]} // 直接输出数组值 {echo $iconColor[$index%3]} // 输出计算后的数组值 // 三目运算 <!--{eval $level_diff_point += ($cur_level == $highest_level - 1 ? 28 : 0);}--> // 获取数组长度 <!--{eval $colSize = sizeof($navlist);}--> or <!--{eval $colSize = count($navlist);}--> // 数据循环 <!--{loop $navlist $item}--> <div class="text-color-6e6 title-text">{$item['desc']}</div> <!--{/loop}--> // 逻辑判断if else if <!--{if $_GET['from']=="mobileapp"}--> <h1>手机访问</h1> <!--{else}--> <h1>非手机访问</h1> <!--{/if}--> // js获取php变量 url = '$_config_di["login"]["h5"]'; οnclick="redirectLink('{$_config_di['forum']}/index1.html')"
Recommended tutorial: "PHP Video Tutorial"
The above is the detailed content of Gathering common PHP front-end syntax. For more information, please follow other related articles on the PHP Chinese website!