ThinkPHP3.2.3版本是一個優化和修正版本,比3.2.2更加穩定、高效和安全,是一個推薦升級的版本,並且實現了對三元表達式的支持,具體代碼以下!javascript
{$status?'正常':'錯誤'}java
{$info['status']?$info['msg']:$info['error']}jquery
注意:三元運算符中暫時不支持點語法。
以下:bootstrap
<div class="modal hide fade" id='myModal'>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" style='background-color: #0ca5ec'>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="color:white;opacity:0.6;">×</button>
<h3 style="color:white">某某某融資網</h3>
</div>
<div class="modal-body">
<p style="text-align:center;color:red;font-size:18px;line-height:20px;padding:0 0 4px 0;">{$popAcData['a_popStatus']?$popAcData['a_Title']:$popHuigu['n_Title']}</p>
<img src="{$popAcData['a_popStatus']?$popAcData['a_Photo']:$popHuigu['n_Image']}" alt="{$popAcData['a_popStatus']?$popAcData['a_Title']:$popHuigu['n_Title']}">
</div>
<div class="modal-footer">
<a href="javascript:void(0);" class="btn">關閉</a>
<a href="javascript:void(0);" class="btn btn-primary">{$popAcData['a_popStatus']?查看活動詳情:查看活動回顧}</a>
</div>
</div>
</div>
</div>安全
<script type="text/javascript" src='__PUBLIC__/popUp/popUp-js/jquery-3.1.0.min.js'></script>
<script type="text/javascript" src='__PUBLIC__/popUp/popUp-js/bootstrap.min.js'></script>
<script type="text/javascript" src='__PUBLIC__/popUp/popUp-js/popUp.js'></script>
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(function(){
//活動開始顯示彈窗 活動沒開始讀活動回顧
$j('#myModal').modal('show');
var btn = $j('.btn');
btn.eq(0).click(function(){
$j('#myModal').modal('hide');
});
btn.eq(1).click(function(){
$j('#myModal').modal('hide');
window.location.href={$popAcData['a_popStatus']}?"{:U('/Activity/detail',array('a_Id'=>$popAcData['a_Id']))}":"{:U('/News/newsContent',array('n_Id'=>$popHuigu['n_Id']))}";
});
})
</script>ide
參看上面例子中的三元表達式加以運用哦。優化