PHP,HTML,Javascript执行顺序 [英] PHP, HTML, Javascript execution order
本文介绍了PHP,HTML,Javascript执行顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个test.php文件,这个文件包含一些PHP代码,HTML元素和一些内部的JavaScript以及一些外部的JavaScript包含。
我想知道哪个是首先加载或执行。
PHP或HTML或JavaScript?我想知道执行顺序。
您的回答非常感谢,对我和其他人也非常有帮助。
PHP首先运行并构建页面。
I have a test.php file and this file contains some PHP code, HTML elements and some internal JavaScript and some external JavaScript include.
I want to know which is first to load or execute.
PHP or HTML or JavaScript? I want to know execution order.
Your answers are greatly appreciated and very helpful to me and others also.
解决方案
Pragmatically speaking, this is the typical order:
- PHP runs first and constructs the page.
- The browser loads the resulting HTML (any JavaScript found gets executed immediately)
- Any JavaScript that was tied to the DOM ready or load event gets executed once the whole HTML is read and all objects are loaded respectively.
这篇关于PHP,HTML,Javascript执行顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文