mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-02 13:12:49 +08:00
改进模板引擎的empty标签
This commit is contained in:
@@ -431,7 +431,7 @@ class Cx extends Taglib
|
||||
{
|
||||
$name = $tag['name'];
|
||||
$name = $this->autoBuildVar($name);
|
||||
$parseStr = '<?php if(empty(' . $name . ') || (' . $name . ' instanceof \think\Collection && ' . $name . '->isEmpty())): ?>' . $content . '<?php endif; ?>';
|
||||
$parseStr = '<?php $_var = ' . $name . ';if(empty($_var) || ($_var instanceof \think\Collection && $_var->isEmpty())): ?>' . $content . '<?php endif; ?>';
|
||||
return $parseStr;
|
||||
}
|
||||
|
||||
@@ -448,7 +448,7 @@ class Cx extends Taglib
|
||||
{
|
||||
$name = $tag['name'];
|
||||
$name = $this->autoBuildVar($name);
|
||||
$parseStr = '<?php if(!(empty(' . $name . ') || (' . $name . ' instanceof \think\Collection && ' . $name . '->isEmpty()))): ?>' . $content . '<?php endif; ?>';
|
||||
$parseStr = '<?php $_var = ' . $name . ';if(!(empty($_var) || ($_var instanceof \think\Collection && $_var->isEmpty()))): ?>' . $content . '<?php endif; ?>';
|
||||
return $parseStr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user