How do I remove  from the beginning of a file?

前端 未结 23 1072
攒了一身酷
攒了一身酷 2020-11-22 06:21

I have a CSS file that looks fine when I open it using gedit, but when it\'s read by PHP (to merge all the CSS files into one), this CSS has the following characters prepend

23条回答
  •  名媛妹妹
    2020-11-22 06:42

    For those with shell access here is a little command to find all files with the BOM set in the public_html directory - be sure to change it to what your correct path on your server is

    Code:

    grep -rl $'\xEF\xBB\xBF' /home/username/public_html
    

    and if you are comfortable with the vi editor, open the file in vi:

    vi /path-to-file-name/file.php
    

    And enter the command to remove the BOM:

    set nobomb
    

    Save the file:

    wq
    

提交回复
热议问题