PHP
downloads | documentation | faq | getting help | mailing lists | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

PHPにできることは?> <はじめに
Last updated: Fri, 14 Nov 2008

view this page in

入門

目次

PHP とはなんでしょう?

PHP ("PHP: Hypertext Preprocessor" を再帰的に略したものです) は、広く使われているオープンソースの汎用スクリプト言語です。 PHP は、特に Web 開発に適しており、HTML に埋め込むことができます。

で、結局のところどういう意味なのでしょう? 以下に例を示します。

例1 初歩的な例

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>Example</title>
    </head>
    <body>

        <?php
            
echo "Hi, I'm a PHP script!";
        
?>

     </body>
</html>

HTMLを出力するために多くのコマンドを記述する (C や Perl のように) 代わりに、PHP のページは "何か" (この例では、"Hi, I'm a PHP script!" と出力) を行うコードを HTML に埋め込むことになります。 PHP のコードは特別な 開始および終了の処理命令 <?php?> で囲まれており、これによって "PHP モード" の切り替えを行います。

PHP がクライアントサイド JavaScript のようなものと異なっている点は、 コードがサーバーで実行され、その結果がクライアントに送信されるということです。 クライアントは、スクリプトを実行した結果を受け取りますが、 その出力を作成したコードがどんなものなのかを知ることはできません。 全てのHTMLファイルをPHPで処理するようにWebサーバー を設定することさえ可能で、この場合、ユーザーが袖の内に何があるかを 見分けることは不可能になることでしょう。

PHPを使用する上で最も優れている点は、初心者に対しては非常に分かり 易いと同時に、プロフェッショナルのプログラマに対しては多くの進んだ 機能を提供している点です。PHPの機能を羅列した長い一覧表を読まなけ ればならないのかと心配する必要はありません。PHPはすぐに始められま すし、数時間の内に簡単なスクリプトが書けるようになります。

PHPを使用した開発ではサーバサイドでの動作に焦点が当てられますが、 他にも多くのことが可能です。 PHPにできることは?まで読み進めてみてください。 Webプログラミングのみに関心がある場合には、 簡易チュートリアルに進んでください。



PHPにできることは?> <はじめに
Last updated: Fri, 14 Nov 2008
 
add a note add a note User Contributed Notes
入門
kissfsf at yahoo dot com
27-Aug-2008 11:09
If you want more open source project of php, visit the following link which also has many free software of other program language like python,java,perl .etc.

http://www.fs-dir.com/language/5/

It's great!
nostamar $AT$ g mail
30-Jan-2008 08:06
here is a "server-php >> html >> browser" process illustration:
http://www.lastown.com/forum/viewtopic.php?t=533

it shows the basic steps; first php code is parsed at server into html; then sent to browser, that understands html tags and renders them to the display the webpage, there's also some quick overview about the process.. worths taking a look at
winks716
19-Aug-2007 10: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 08: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.]

PHPにできることは?> <はじめに
Last updated: Fri, 14 Nov 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites