Re: newbie question

From: Date: Wed, 16 Sep 2015 17:26:12 +0000
Subject: Re: newbie question
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-325116@lists.php.net to get a copy of this message
On Sep 16, 2015, at 8:30 AM, Tedd Sperling wrote:
On Sep 16, 2015, at 2:48 AM, Ashley Sheridan <ash@ashleysheridan.co.uk> wrote:
On Tue, 2015-09-15 at 20:22 -0700, Jeffry Killen wrote:
This confuses people often who are new to php because the code is written directly into the html file.
I think this is the one of the causes of confusion. HTML is written directly into a PHP file. :) Thanks, Ash http://www.ashleysheridan.co.uk
Ash is correct. More specifically, PHP code delivers web languages to a user's Browser. The Browser never actually see’s PHP scripts because PHP runs on the server (not the client) and delivers what it wants to the Browser via client-side web languages (i.e., HTML, CSS, JavaScript et al). In other words, by the time the Browser see’s anything, PHP is finished. Cheers, tedd
O.K. this is another way of looking at it. But as I understand it, when the web server is asked to produce a resource in the form of a text file with a .php extention the raw html/css/javascript it sees it delivers directly. When it sees opening and closing php tags it hands that off to the php interpreter which then returns the result to the server. Then the server delivers the result of the php code processing. In files that are included, that have no html, nothing is sent to the client unless there is a print or echo statement in that file. With a print or echo statement it is still the server which sends it as html and text. It is possible to have a resource with a php extention, that has no php code in it, only html/css/javascript. That would get sent. JK

« previous php.general (#325116) next »