2
<meta property="og:image" content="{$Image|regex_replace:"/(div class=+)/i":""}" />
我想爲此添加撇號,以便我可以將它們替換爲無。我將如何實現這一目標?在smarty中用preg_replace替換撇號
<meta property="og:image" content="{$Image|regex_replace:"/(div class=+)/i":""}" />
我想爲此添加撇號,以便我可以將它們替換爲無。我將如何實現這一目標?在smarty中用preg_replace替換撇號
{$Image|replace:"'":$var}
只是櫃面你仍然不知道Smarty的方式做到這一點
爲什麼你不只是做PHP的一面呢?附:上帝,聰明是醜陋的... –
+1爲Briedis。我同意使用smarty執行php操作是愚蠢的......而且我是Smarty的辯護人。限制你的視圖來顯示邏輯。 – rdlowrey
我繼續把它放在我的php中。找出在PHP中執行它的代碼是一個簡單的str_replace(「'」,'',$ var); – wowzuzz