smarty的输出过滤器用你的cdn url替换smarty模板中的图像URL 即像这样的图像:
<img src="/images/image.gif"/>
<img src="http://cdn.yoursite.com/images/image.gif"/>
答案 0 :(得分:1)
我认为有那种
<?php function smarty_outputfilter_cdn($tpl_source, &$smarty) { if($_SERVER["SERVER_PORT"] == 80) { $tpl_source = preg_replace('/("|\')((\.\/|\/)[A-z0-9_\-\/@\.]+\.(jpg|jpeg|gif|png))("|\')/i', "\"http://cdn.yoursite.com\\2\"", $tpl_source); } return $tpl_source; } ?>