douluozhan4370
douluozhan4370
2019-02-05 07:08

在树枝上有正则表达式的问题?

  • regex
  • php

i want to change src="" value to be empty if src="assets/js/asd2323/script.js"

with regex in twig src value not empty. it has script src

i don't want to empty all my src attribute values within my loops :|

{% for script in site['scripts'] %}
    <script type="text/javascript" 
    {% if script['src'] == matches '{(script.js)}' %}

    {% else %} 
         src="{{ script['src'] }}"
    {% endif %}
    >
{% endfor %}
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐