Home > Backend Development > PHP Tutorial > PHP新手,如何在PHP中导入JavaScript文件?

PHP新手,如何在PHP中导入JavaScript文件?

WBOY
Release: 2016-06-23 13:52:31
Original
1166 people have browsed it

为什么在php中嵌入JavaScript可以,导入JavaScript文件就不行?
1. 直接嵌入

<?php?><script >alertalert('');</script>
Copy after login

这样可以

2. 把alertalert('');放入文件test.js然后
<?php?><script scr="test.js"></script>
Copy after login

这样就不行

3.最后把alertalert('');放入文件test.php然后
<?phprequire 'test.php'?>
Copy after login

这样就又可以。

专家给新手扫盲一下呗。


回复讨论(解决方案)

src 和 scr 还是有区别的吧?

src 和 scr 还是有区别的吧?


好吧,我承认这次太糗了。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template