Home  >  Article  >  Backend Development  >  How to reference js in php file

How to reference js in php file

王林
王林Original
2019-09-18 13:04:3411298browse

How to reference js in php file

#The introduction of js into php files is usually divided into two situations: the same file and external files.

1. In the same situation

You can use tags directly when introducing js in the same file, for example:

<?php
echo "<script>*********</script>";
?>

2. External files

php introduces external js files. You need to write the following content outside the body, for example:

<script src="****.js" type="javascript"></script>

The above content is for reference only!

Recommended tutorial: PHP video tutorial

The above is the detailed content of How to reference js in php file. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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