javascript - PHP - Where to put it -


Maybe very simple PHP question I'm just learning how to create my first website, which uses a database (and What is the general practice of where to put your PHP code? When I learned in CodeCadi, PHP was placed in my HTML (and I replace index.html with index.php).

When I go to websites like Google, YouTube or this, you do not see any PHP in the HTML source code. I'm assuming that the code is behind scenes, like JavaScript. PHP (and other server-side scripting languages, such as Python and Ruby)

exists only on server , It is not sent to the client. When you use a web page that is implemented using a server script, the server runs the script, and the script produces HTML it is sent to the browser.

PHP may be confusing in this regard because it is an embedded language inside the block of HTML (or any other language) & lt ;? Php ...? & Gt; Enter it looks like HTML because & lt; ... & gt; Bracketting, but it is not. The PHP processor just starts copying the contents of the file to its output, but when it does and is encountered, then it starts up to processing it as executable PHP code until it returns to ? & Gt; or the end of the file. But only the output of that code block is sent, not the block itself.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -