A collection of common PHP front-end syntax

巴扎黑
Release: 2016-11-09 13:49:43
Original
1394 people have browsed it

// 定义变量
<!--{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 ? &#39;vip-gray&#39; : &#39;&#39;;}-->
{$item[&#39;icon&#39;]}             // 输出对象值
{$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[&#39;desc&#39;]}</div>
<!--{/loop}-->
// 逻辑判断if else if
<!--{if $_GET[&#39;from&#39;]=="mobileapp"}-->
<h1>手机访问</h1>
<!--{else}-->
<h1>非手机访问</h1>
<!--{/if}-->
// js获取php变量
url = &#39;$_config_di["login"]["h5"]&#39;;
onclick="redirectLink(&#39;{$_config_di[&#39;forum&#39;]}/index1.html&#39;)"
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!