入门指引
在线手册:中文 英文
PHP手册

简介

Table of Contents


入门指引
在线手册:中文 英文
PHP手册
PHP手册 - N: 简介

用户评论:

imajeffs at hotmail dot com (16-Nov-2009 01:11)

Technically the web server always runs first. It doesn't understand PHP itself, but must be configured to detect whether the location requested by the client (browser) contains PHP segments or not. For example, any file with extension ".php" may be processed by invoking the PHP which interprets the PHP segments and feeds the entire HTML back to the server. It then returns that complete content back to the client.

winks716 (19-Aug-2007 03:48)

before html runs to show a webpage, php code runs first on web server.

so, when there lines as follow:

<table>
<tr>
<td>
  <?php
   
echo "php runs first!";
 
?>
</td>
</tr>
</table>

the first step is to run php code, we get:

<table>
<tr>
<td>
php runs first
</td>
</tr>
</table>

then, code is sent to browser, and we see somthing~

george dot langley at shaw dot ca (19-Jul-2007 01:02)

"the code is executed on the server"

This is an important concept for the first-time PHP programmer to understand, so that when you get into string formatting later on, you understand the difference between formatting the on-screen content (as parsed by your browser) and formatting the HTML code (as returned by the server).
For example "\n" starts a new line in the HTML code, and its results are only seen if you look at the "source HTML". It is NOT the same as <br>!

[EDIT BY danbrown AT php DOT net:  Corrected typo in post.  Thanks to PHP at ANDY dot COM dot PT for pointing out the issue.]