Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress tinymce.js被解析为PHP?_Wordpress_Tinymce - Fatal编程技术网

Wordpress tinymce.js被解析为PHP?

Wordpress tinymce.js被解析为PHP?,wordpress,tinymce,Wordpress,Tinymce,我的WordPress“编辑帖子”页面中的TinyMCE编辑器似乎已损坏。Chrome控制台显示: Resource interpreted as Script but transferred with MIME type text/html: "http://mysite.com/wp-includes/js/tinymce/langs/wp-langs-en.js?ver=349-20805". post.php:62 Resource interpreted as Script but t

我的WordPress“编辑帖子”页面中的TinyMCE编辑器似乎已损坏。Chrome控制台显示:

Resource interpreted as Script but transferred with MIME type text/html: "http://mysite.com/wp-includes/js/tinymce/langs/wp-langs-en.js?ver=349-20805". post.php:62
Resource interpreted as Script but transferred with MIME type text/html: "http://mysite.com/wp-includes/js/tinymce/tiny_mce.js?ver=349-20805". post.php:62
Uncaught SyntaxError: Unexpected token <          tiny_mce.js:1
Uncaught ReferenceError: tinyMCE is not defined   wp-langs-en.js:1
Uncaught ReferenceError: tinymce is not defined   post.php:1180
而这一回应:

<br />
<b>Parse error</b>:  syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in <b>/home/mysite/public_html/wp-includes/js/tinymce/tiny_mce.js</b> on line <b>1</b><br />

分析错误:语法错误,第1行/home/mysite/public\u html/wp includes/js/tinymce/tiny\u mce.js中出现意外的T_常量\u封装字符串
正在正确检索和执行其他各种.js文件。关闭W3TC没有什么区别。Firefox中也存在这个问题。问题似乎是突然出现的,;我不知道我做了什么改变,甚至没有更新或安装/卸载插件


提前感谢。

除非PHP正在处理.js文件请求,否则这不会发生

检查Apache2 conf文件,并检查conf.d文件夹中的所有conf.d文件。还要检查.htaccess文件。在这些文件中,请查找以下内容:

AddHandler application/x-httpd-php .js
<FilesMatch ".js$">
AddHandler application/x-httpd-php .js
php_value default_mimetype "text/javascript"
</FilesMatch>
它可能发生在如下块中:

AddHandler application/x-httpd-php .js
<FilesMatch ".js$">
AddHandler application/x-httpd-php .js
php_value default_mimetype "text/javascript"
</FilesMatch>

AddHandler应用程序/x-httpd-php.js
php_值默认值_mimetype“text/javascript”
一些.htaccess和apache配置教程建议使用PHP来处理.js文件,因为它可以让您使用一些技巧。最常见的原因是调用PHPgzip文件来压缩JS文件。不幸的是,使用php处理tiny_mce.js似乎破坏了Wordpress。PHP被微小的_mce.js文件中的某个东西绊倒了——也许是因为它被缩小了

我遇到了这个问题,不得不从配置中删除.js文件的php处理程序。实际上不需要它,因为我的Apache配置为自己进行压缩。我不是调用PHP文件来执行gzip。依靠PHP脚本进行zip压缩并不是做事情的最佳方式(显然,这会产生类似这样的问题!)

希望这对别人有帮助

读者可能也会发现这篇文章很有用:


我还要补充一点,出于性能考虑,任意使用PHP处理JS和CSS等静态文件不是一个好主意。除非文件是真正动态的,否则不应该调用PHP处理程序。否则,您将向服务器添加不必要的资源需求。

您确定没有使用php将js文件包含在某个地方吗
grep-r-n-I--color/home/mysite/public_html/tiny_mce.js
,还是整个目录?还要检查该文件夹中的http conf和any.htaccess,或者它的任何父文件夹都没有将该文件/文件夹视为phpthanks man!我一直在寻找解决这个问题的办法。