简体   繁体   English

php文件无法在javascript中作为src工作

[英]php file is not working as src in javascript

I made a dynamic php file to show different text using java script. 我制作了一个动态php文件,以使用Java脚本显示不同的文本。 People uses this to show texts in their website. 人们使用它来在他们的网站上显示文本。

They use this code 他们使用此代码

    <script type="text/javascript" src="http://alquranbd.com/source/q1.php"></script>

And the http://alquranbd.com/source/q1.php this file generates a code like this: http://alquranbd.com/source/q1.php这个文件会生成如下代码:

document.write("এরাই পরকালের বিনিময়ে পার্থিব জীবন ক্রয় করেছে। অতএব এদের শাস্তি লঘু হবে না এবং এরা সাহায্যও পাবে না। (Al-Baqarah-86)");

When people using this php file as src in their website this is not showing text. 当人们在其网站上使用此php文件作为src时,这不会显示文本。 But it was showing text a few weeks ago. 但是几周前它正在显示文本。 Why this is not working now? 为什么现在不起作用?

在任何输出之前添加此文件(在文件开头)

header('Content-Type: text/javascript; charset=utf-8');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM