Home > Backend Development > PHP Tutorial > PHP新手,怎么在PHP中导入JavaScript文件

PHP新手,怎么在PHP中导入JavaScript文件

WBOY
Release: 2016-06-13 12:03:44
Original
1085 people have browsed it

PHP新手求助,如何在PHP中导入JavaScript文件?
为什么在php中嵌入JavaScript可以,导入JavaScript文件就不行?
1. 直接嵌入

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

这样可以

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

这样就不行

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

这样就又可以。

专家给新手扫盲一下呗。
------解决方案--------------------
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