javascript文件中附加了非法字符

Illegal Characters appended to javascript file

本文关键字:非法 字符 文件 javascript      更新时间:2023-09-26

我认为我的apache Web服务器出现了问题。我不能引用jquery.js

我得到以下错误:

带铬:

Uncaught SyntaxError: Unexpected token ILLEGAL

使用firefox:

Error: illegal character
Source File: http://xxxxxxxxx/test/javascript/jquery.js
Line: 1
Source Code:
�Hz�ÚH[9�R

下面是我的测试html代码

<html>
<head>
    <script type="text/javascript" src="javascript/jquery.js"></script>
    <script type="text/javascript">
        function doclick(){
            jQuery('#hello').attr('value', "mmmmef")
        }
    </script>
</head>
<body>
    <input type="button" name="hello" id="hello" value="hello" onclick="doclick();" />
</body>
</html>

这种情况不仅发生在jquery.js上,这些非法字符被附加到所有jscss文件中。

我使用ssh登录,并使用vi命令查看这些jscss文件,但没有这些字符。但是,当我尝试使用FTP客户端Filezilla或CuteFTP下载或查看/编辑时,这些非法字符会被包括在内。

我的服务器出了什么问题?同样的代码可以在我的本地windows服务器和另一个centos服务器上运行。

我在找到了解决方案

http://www.cyberciti.biz/tips/apache-223-corrupt-file-download-issue.html

只需打开httpd.conf并在下面的行中放入

            EnableMMAP off
            EnableSendfile off

然后

            # /sbin/service httpd restart