简体   繁体   English

为什么那么extweb团队页面包括一个带有外部php文件<script> tag

[英]why is thenextweb team page including an external php file with <script> tag

I was looking at thenextweb's team page and found that inside < head>, they are including an external php file within the < script> tag. 我正在查看thenextweb的团队页面,发现在<head>内部,它们在<script>标记内包含一个外部php文件。 Is this a good practice ? 这是一个好习惯吗? And what might be the purpose of doing this ? 这样做的目的是什么?

URL: http://thenextweb.com/about/team/ 网址: http //thenextweb.com/about/team/

Code: 码:

<script type="text/javascript" src="/about/php/scriptsData.php"></script>

JavaScript files need not have the .js extension. JavaScript文件不必具有.js扩展名。 Sometimes you need to generate JavaScript dynamically and you end up with a .php file. 有时,您需要动态生成JavaScript,最终得到一个.php文件。 For example, for placing markers in a Google map with the API, I generated the JavaScript file with php (fetching the marker locations from a database) rather than using some sort of AJAX. 例如,为了使用API​​在Google地图中放置标记,我使用php(从数据库中获取标记位置)生成了JavaScript文件,而不是使用某种AJAX。 There's nothing wrong with it. 没有错。

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

相关问题 通过src标记在html页面中包含外部javascript文件 - Including external javascript file in html page via src tag 包含没有 HTML 脚本标签的外部 JS 脚本 - Including external JS script without the HTML script tag 为什么代码在其中工作<script> tag, but not in external .js file? 🤨 - Why does the code work within <script> tag, but not in external .js file? 🤨 jQuery将外部脚本丰富的PHP文件加载到本地页面 - jQuery Load an external script rich PHP file into local page 在外部php文件中包含缩小的javascript - Including minified javascript in external php file 通过PHP直接包含JavaScript,而不是通过脚本标记从最终页面中取代它 - Including JavaScript direcly through PHP instead of laoding it from the final page throught a script tag 为什么在包含脚本标记的同时获取404 js文件? - Why am i getting a 404 js file, while including a script tag? 通过 PHP 文件 include vs script src 包含外部脚本有什么好处或坏处? - Any benefits or downsides to including external scripts via PHP file include vs script src? 在外部JS文件中包含PHP变量? - Including PHP variables in an external JS file? 为什么我的 js function 在脚本标签内工作,为什么不在外部 javascript 文件 django - Why my js function works inside of script tag and why not in an external javascript file django forms
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM