Re: newbie question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 16 September 2015 18:26:12 BST, Jeffry Killen <jekillen@xxxxxxxxxxx> wrote:
>
>On Sep 16, 2015, at 8:30 AM, Tedd Sperling wrote:
>
>> On Sep 16, 2015, at 2:48 AM, Ashley Sheridan  
>> <ash@xxxxxxxxxxxxxxxxxxxx> 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
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

Almost. Actually, it's the web server which sees that as non-php content and just outputs it to the standard output to be sent to your browser. most web servers, when not told what type of content is being sent (with a header call) will default to HTML.

Now, if you had set a different header, the browser would think your output wasn't HTML, and would probably crap out.

It's still HTML in your PHP files, hence the need for the specific file extension. 

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux