smarty模板判断数组为空的方法


本文实例讲述了smarty模板判断数组为空的方法。分享给大家供大家参考。具体如下:

这里主要介绍两种方法:

1. 用count来取得数组的下标个数

下面例子中,如果$array为空则不输出任何数据

{if $array|@count neq 0 }
// array is empty
{/if}

2. 直接判断

{ if $array neq ""}
//array is empty
{/if}

希望本文所述对大家基于smarty模板的php程序设计有所帮助。

CodeIgniter针对lighttpd服务器URL重写的方法
本文实例讲述了CodeIgniter针对lighttpd服务器URL重写的方法。分享给大家供大家参考。具体实现方法如下:由于开发环境使用的是lighttpd服务器,我本机环

php中smarty变量修饰用法实例分析
本文实例讲述了php中smarty变量修饰用法。分享给大家供大家参考。具体实现方法如下:test.php代码:phprequire'libs/Smarty.class.php';//包含Smarty类库文件$smarty=n

php 在线导入mysql大数据程序
php在线导入mysql大数据程序phpheader("content-type:text/html;charset=utf-8");error_reporting(E_ALL);set_time_limit(0);$file='./test.sql';$data=file($file);echo"pre";//print_r($data);$data_new=