diff --git a/framework/library/template/driver/engine/Engine.php b/framework/library/template/driver/engine/Engine.php index dc0736e..ed02f8d 100644 --- a/framework/library/template/driver/engine/Engine.php +++ b/framework/library/template/driver/engine/Engine.php @@ -396,9 +396,10 @@ class Engine */ private function _if($tag, $content) { + $tag['condition'] = $this->_parseCondition($tag['condition']); $parse = ''; $parse .= $content; - $parse .= ''; + $parse .= ''; return $parse; } @@ -410,6 +411,7 @@ class Engine private function _else($tag) { if (isset($tag['condition'])) { + $tag['condition'] = $this->_parseCondition($tag['condition']); $parse = ''; } else { $parse = ''; @@ -417,6 +419,34 @@ class Engine return $parse; } + /** + * 处理if/else标签的条件比较符 + * @param $condition + * @return mixed + */ + private function _parseCondition($condition) + { + return str_ireplace([ + ' eq ', + ' neq ', + ' lt ', + ' elt ', + ' gt ', + ' egt ', + ' heq ', + ' nheq ' + ], [ + ' == ', + ' != ', + ' < ', + ' <= ', + ' > ', + ' >= ', + ' === ', + ' !== ' + ], $condition); + } + /** * volist标签 * @param $tag