Wou*_*elo 0 html php zend-framework strip zend-view
Smarty有{strip}功能:
{strip}
<table border='0'>
<tr>
<td>
Hello world
</td>
</tr>
</table>
{/strip}
Run Code Online (Sandbox Code Playgroud)
哪个输出:
<table border='0'><tr><td>Hello world</td></tr></table>
Run Code Online (Sandbox Code Playgroud)
我还想在Zend中做到这一点(减少每次请求发送的咬伤量),而不安装Smarty.
但是,我不想在每个Layout/.phtml文件中添加代码,因此frontcontroller插件会很好.
为什么不使用Smarty使用的相同正则表达式.这很简单:
function strip($str, $replace = ' ')
{
return preg_replace('#\s+#', $replace, $str);
}
Run Code Online (Sandbox Code Playgroud)