Tuesday, December 31, 2019
Why Dont I See My PHP Code When I View Source
Web developers and others who are knowledgeable about web pages know you can use a browser to view the HTML source code of a website. However, if the website contains PHP code, that code is not visible, because all the PHP code is executed on the server before the website is sent to a browser. All the browser ever receives is the result of the PHP embedded in the HTML. For this same reason, you cannot go to a .php file on the web, save it, and expect to see how it works. You are only saving the page produced by the PHP, and not the PHP itself. PHP is a server-side programming language, meaning it is executed at the web server before the website is sent to the end-user. This is why you cant see the PHP code when you view the source code. Sample PHP Script When this script appears in the coding of a web page or .php file that is downloaded by an individual to a computer, that viewer sees: My PHP Page Because the rest of the code is just instructions for the webà server, it isnt viewable. A view source or a save simply displays the results of the codeââ¬âin this example, the text My PHP Page. Server-Side Scripting vs. Client-Side Scripting PHP isnt the only code that involves server-side scripting, and server-side scripting isnt limited to websites. Other server-side programming languages include C#, Python, Ruby, C and Java.à Client-side scripting operates with embedded scriptsââ¬âJavaScript is the most commonââ¬âthat are sent from the web server to a users computer. All the client-side script processing takes place in a web browser on the end-users computer.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.