Zend在Smarty中有类似{strip}的东西吗?

时间:2010-10-26 22:56:42

标签: php html zend-framework strip zend-view

Smarty有{strip}功能:

{strip}
<table border='0'>
 <tr>
  <td>
   Hello world
  </td>
 </tr>
</table>
{/strip}

哪个输出:

<table border='0'><tr><td>Hello world</td></tr></table>

我也想在Zend中做这件事(减少每次请求发送的咬伤量),而不安装Smarty。

但是,我不想在每个Layout / .phtml文件中添加代码,因此前置控制器插件会很好。

1 个答案:

答案 0 :(得分:5)

为什么不使用Smarty使用的相同正则表达式。这很简单:

function strip($str, $replace = ' ')
{
    return preg_replace('#\s+#', $replace, $str);
}
相关问题