[英]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.