duanqiaoren9975 2018-07-23 06:28
浏览 56

相当复杂的PHP到Twig字符串转换

I have a string I'm having trouble converting to twig, I've already tried the PHP to twig converters and am having no luck. Any ideas on how to format this in twig?

<?php $string = strtr($model, array('-R' => '', '-r' => '', ' ' => '', '-reconditioned' => ''));  ?>
  • 写回答

1条回答 默认 最新

  • douzhuo3233 2018-07-23 09:05
    关注

    The filter replace uses strt as underlaying function, as seen in the source of twig

     {{ example | replace({ '-r': '', '-R': '', '-reconditioned': '',}) }} 
    
    评论

报告相同问题?