duanna2026 2012-10-27 10:24
浏览 104
已采纳

如何从一堆html页面中删除特定行?

I have bunch of HTML pages, each contains a line at the top of the page, the line is

<?xml version="1.0" encoding="UTF-8" ?>

pages were opening perfectly when I was running on localhost, now I have uploaded the files to server, and its giving me an error. the error is,

Parse error: syntax error, unexpected T_STRING in /home/a7597163/public_html/secretary.html on line 1

when I remove this line the page is displayed without any error, but the problem is I cant manually remove each line out of it, can anybody tell me how can I remove that line from each page... I tried using this

document.body.innerHTML = document.body.innerHTML.replace( /<?xml version="1.0" encoding="UTF-8" ?>/g, "");

but didnt work.

Thanks

  • 写回答

4条回答 默认 最新

  • douxiawei9318 2012-10-27 10:28
    关注

    If it is a PHP error. It is being thrown at the server-end, well before the client sees it and the JavaScript has time to act on it. So no JavaScript can solve this.

    So here, the solution would be to modify or rather remove the line at the source as it is syntactically incorrect in the PHP-file itself when short-tags are turned on.

    If your hosting provider does allow you to edit php.ini, you could do short_open_tag=Off. But that will also cause any other <? ... ?> PHP-blocks to stop working.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路