CSS parser using PHP

后端 未结 5 1725
有刺的猬
有刺的猬 2020-12-21 20:07

Here\'s my css link for images:

background-image:url(images/background.gif);

I just want to add some: ../ to change the direct

相关标签:
5条回答
  • 2020-12-21 20:16
    $css = str_replace("url(images/", "url(../images/", $css);
    
    0 讨论(0)
  • 2020-12-21 20:23

    You must use regex to parse css correctly

    regex to parse your code  :  '/(url)\s*\(\s*[\w\W]+\)/ms'
    
    0 讨论(0)
  • 2020-12-21 20:25

    PHP-CSS-Parser is a CSS parser written in PHP under the MIT license.

    0 讨论(0)
  • 2020-12-21 20:32

    Could you not just do a find and replace in your CSS for "(images/" and replace with "(../images/" ??

    0 讨论(0)
  • 2020-12-21 20:37

    http://pear.php.net/package/HTML_CSS/

    0 讨论(0)
提交回复
热议问题