54 5 PHP Web hellow.php 1:<?php 2: echo "Hellow, PHP!Y=n"; 3:?> echo PHP C 2: printf("hellow, PHP!Y=n"); PHP (php) $ php hellow.php Hellow, PHP! 5.1.2

Similar documents
ohp.mgp

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

実験 5 CGI プログラミング 1 目的 動的にWebページを作成する手法の一つであるCGIについてプログラミングを通じて基本的な仕組みを学ぶ 2 実験 実験 1 Webサーバの設定確認と起動 (1)/etc/httpd/conf にある httpd.conf ファイルの cgi-bin に関する

1

untitled

untitled

h1,..., h6: (heading) h1 h2 table: table tr (table row) tr td (table data) ol, ul: (ordered) (unordered) </tag1> </tag4> 1: HTML [1] html: Web HTML he

演習室の PC のハードディスクには演習で作成したデータは保管できません 各 PC の ネットワーク接続 ショートカットからメディア情報センターのサーバーにアクセスしてください (Z ドライブとして使用できます ) 講義で使うフォルダ 2/23

ii II Web Web HTML CSS PHP MySQL Web Web CSS JavaScript Web SQL Web

World Wide Web =WWW Web ipad Web Web HTML hyper text markup language CSS cascading style sheet Web Web HTML CSS HTML

C G I 入 門 講 座

pdf

Webデザイン論

soturon2013

wide94.dvi

演習室の PC のハードディスクには演習で作成したデータは保管できません 各 PC の ネットワーク接続 ショートカットからメディア情報センターのサーバーにアクセスしてください (Z ドライブとして使用できます ) Web プログラミング 1 CGI (3 章 ) 2012/6/12( 水 ) 講義

2009 Web B012-1

方程式を解いてみよう! C++ から PHP + JavaScriptへ

SVG資料第10回目(その2) Ajaxによる同期通信と非同期通信の違い


div: 3 span: 4 h1,..., h6: (heading) h1 h2 </tag1> table: table tr (table row) tr td (table data) ol, ul: (ordered) (unordered) </tag4> 1: HTML

2003年度 情報処理概論

オンラインテスト

0序文‐1章.indd

6 2 s µ µµµ µµµµ µ µ h µs µ µµµµ µ µ µ s mµµµµµ µµµ µµ µ u m µmµµµµµ µµ µ µ µ µ µ µ µ µ s 1


untitled

TCP/IP Internet Week 2002 [2002/12/17] Japan Registry Service Co., Ltd. No.3 Internet Week 2002 [2002/12/17] Japan Registry Service Co., Ltd. No.4 2

PowerPoint プレゼンテーション

Webデザイン論

6 2 1


ORCA (Online Research Control system Architecture)

07_経営論集2010 小松先生.indd

山梨県ホームページ作成ガイドライン

Homepage HTML+CSS Flash JavaScript Homepage Homepage Homepage Homepage Web HTML Hyper Text Markup Language XHTML XHTML HTML5 CSS Cascading Style Sheet

forever朝活

3 Powered by mod_perl, Apache & MySQL use Item; my $item = Item->new( id => 1, name => ' ', price => 1200,

第 7 回の内容 動的な Web サイト フォーム Web システムの構成

Microsoft PowerPoint - Lecture_2

InterSafe Personal_v2.3 ユーザーズガイド_初版

リスト 1 1 <HTML> <HEAD> 3 <META http-equiv="content-type" content="text/html; charset=euc-jp"> 4 <TITLE> 住所の検索 </TITLE> 5 </HEAD> 6 <BODY> <FORM method=

FileMaker Server Getting Started Guide

hands_on_4.PDF

untitled

ほんぶん-第14章.indd

Flash Player ローカル設定マネージャー

FileMaker Server 9 Getting Started Guide

情報システム設計論II ユーザインタフェース(1)

■サイトを定義する


~/WWW-local/compIID (WWW IID ) $ mkdir WWW-local $ cd WWW-local $ mkdir compiid 3. Emacs index.html n (a) $ cd ~/WWW/compIID

SVG資料第6回目(その3) SVGとHTMLの間でデータを交換する

25 About what prevent spoofing of misusing a session information


FileMaker Server Getting Started Guide

PowerPoint Presentation

! "#$%&'()*+,-. STUV WXYZ[\]^_`abcdefghijklmno pqrstuvwxyz{ }~ ƒ ˆ Š Œ Ž š œ žÿ ª«±²³ µ ¹º»¼½¾ ÀÁÂÃÄ ÅÆÇÈÉÊËÌÍÎÏÐ

22 (266) / Web PF-Web Web Web Web / Web Web PF-Web Web Web Web CGI Web Web 1 Web PF-Web Web Perl C CGI A Pipe/Filter Architecture Based Software Gener

( 前回 ) 提出課題 課題 1( 提出課題 ): データベースからデータを読み込み, そのデータを表示する Web ページ作成してみましょう user テーブルから書籍のデータを一覧表示する. 手順 1:PHP のファイルを user_list.php という名前で作業フォルダに作成する. プログ


PowerPoint Presentation

PowerPoint プレゼンテーション

Microsoft PowerPoint - 04WWWとHTML.pptx


A/B WWW MTA/MSP sendmail POP/IMAP apache WWW 1 1 sendmail uw imap apache WWW host host subnet1: /24 IF1: router & server mail and

教材ドットコムオリジナル教材

̤Äê

メディプロ1 Javaサーブレット補足資料.ppt

Mac OS X Server QuickTime Streaming Server 5.0 の管理(バージョン 10.3 以降用)

ÉvÉçPM_02

2 / 16 HTML=HyperText Markup Language( ハイパーテキストマークアップランゲージ ) ブラウザ (Chrome) での表示 ソースの表示 ( メモ帳 /TeraPad) HTML <========= =========>

インターネットマガジン1996年3月号―INTERNET magazine No.14

スライド タイトルなし

Microsoft Word - PHP_SQLServer2012

08+11Extra

■新聞記事

Webデザイン論

PowerPoint プレゼンテーション

WIDE 1

HTML文書の作成

96 8 PHPlot 1. ( 8.1) 4 1: // 2: // $_SERVER[ HTTP_REFERER ]... 3: // $_SERVER[ HTTP_USER_AGENT ]... 4: // $_SERVER[ REMOTE_ADDR ]... ( ) 5: // $_SERV

<48746D6C8AEE91628D758DC02E786C73>


div: 3 span: 4 h1,..., h6: (heading) h1 h2 </tag1> table: table tr (table row) tr td (table data) ol, ul: (ordered) (unordered) </tag4> 1: HTML


経営論集2011_07_小松先生.indd

FileMaker Instant Web Publishing Guide

FileMaker Instant Web Publishing Guide

FileMaker Instant Web Publishing Guide

PowerPoint Presentation

FileMaker Instant Web Publishing Guide

b /b br / b /b b /b i /i b i /b i i -1/14-

CodeIgniter Con 2011, Tokyo Japan, February

C¥×¥í¥°¥é¥ß¥ó¥° ÆþÌç

LHD-LAN_E_G_PDF.}.j...A...p65

Webプログラミング演習

11

Microsoft Word - 倫理 第40,43,45,46講 テキスト.docx

untitled

Transcription:

53 5 PHP Web Web 1 Web OS (Web) HTML Web Web Web 5.1 PHP Web PHP ( ) 5.1.1 hellow.php ( ) Hellow, PHP! PHP hellow.php PHP HTML PHP <?php...?>

54 5 PHP Web hellow.php 1:<?php 2: echo "Hellow, PHP!Y=n"; 3:?> echo PHP C 2: printf("hellow, PHP!Y=n"); PHP (php) $ php hellow.php Hellow, PHP! 5.1.2 quadratic eq.php 2 Complex! PHP quadratic eq.php 1: <?php 2: echo "a * xˆ2 + b * x + c = 0Y=n"; 3: 4: echo "a = "; $a = trim(fgets(stdin)); 5: echo "b = "; $b = trim(fgets(stdin)); 6: echo "c = "; $c = trim(fgets(stdin)); 7: 8: printf("%f * xˆ2 + %f * x + %f = 0Y=n", $a, $b, $c); 9: 10: $d = $b * $b - 4.0 * $a * $c; 11: 12: if($d >= 0.0) 13: { 14: echo "Real solutions:y=n"; 15: printf("x1 = %fy=n", (-$b + sqrt($d)) / (2.0 * $a)); 16: printf("x2 = %fy=n", (-$b - sqrt($d)) / (2.0 * $a)); 17: } 18: else 19: { 20: echo "Complex!Y=n"; 21: } 22:?>

5.1 PHP 55 pp.38 C (quadratic eq.c) PHP (CUI) PHP (php ) $ php quadratic_eq.php quadratic_eq.php a * xˆ2 + b * x + c = 0 a = 1 1 b = 2 2 c = 3 3 1.000000 * xˆ2 + 2.000000 * x + 3.000000 = 0 Complex C ( if $a = 3; $b = 4; print $a + $b =. ($a + $b). "Y=n"; $a, $b PHP $ $ [0], [1],... [ 1], [ 2],... (hash) ( ) ( ) PHP print $a + $b =. ($a + $b). "Y=n"; $a = 3, $b = 4 $a + $b = 7 print "$a + $b = ". ($a + $b). "Y=n";

56 5 PHP Web 3 + 4 = 7 ( ) ( ) (.) 1. 2 A C (pp.39) PHP 1. 2 a 2x 2 + 12x + 18 = 0 (x 1 = x 2 = 3) b 32x 2 732160x 516544800 = 0 (x 1 = 23565, x 2 = 685) 2. quadratic eq.php 3*. a = 0 1 bx + c = 0 4*. a, b, c is numeric 5.2 Web 1 Web HTML HTML

5.2 Web 57 5.2.1 Web Web pp.9 1.7 Web http://www.sist. ac.jp/ tkouya/index.html 5.1 Web!!$"&# *+,-.*/0*12,345 *63789/:+1-8* ;<=>?@ 9AB.CD+1-8EFGH (#$"% ') 5.1 Web 1 Web GET ( index.html) 2 index.html 3 index.html CSS (Flash ) 1 URL 5.2 http://www.sist.ac.jp http: HTTP(HyperText Transport Protocol) Web www.sist.ac.jp FQDN(Fully Quolified Domain Name) 133.88.240.21 IP DNS (Domain Name Service) Web TCP 80

58 5 PHP Web,*&,*+/0 -.123 4567 89:; <34= "" #! # &$(%') VYZ([W\] ^_`aibc >? @>ABCD /EFGHI @>JBKLMNOFPQRSTU'VWX ABC\]^_`aIbc 5.2 URL(URI) GET / tkouya/index.html GET ( ) URL( ) 5.2.2 HTML CSS HTML(HyperText Markup Language) ( ) Web (tag) < > </ > HTML <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> Web "UTF-8" <link rel=stylesheet" href="hogehoge.css" type="text/css" /> <title>web </title> </head> <body> Web </body> </html>

5.3 HTML PHP 59 html head body head HTML ) body Web HTML HTML CSS( hogehoge.css ) 5.3 HTML PHP Web ( public_html public_html Others $ pwd /home/tkouya/public_html $ ls -ld./ drwxr-xr-x 9 tkouya tkouya 4096 1 4 20:36./ $ ls -ld../ drwxr-xr-x 31 tkouya tkouya 4096 1 20 15:09../ (2.3.3, P.18) public_html index.html <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title> </title> </head> <body> <h1> </h1> <p> : 2018-06-01 (Fri)</p> <hr> <ol> <li><a href="keisan.php">keisan.php</a></li> <li>2 </li> </ol> <hr>

60 5 PHP Web <address>copyright (c) Tomonori kouya</address> </body> </html> (Internet Explorer, Firefox, Chrome ) Web HTML URL http://web / /index.html http://web / / *1 Web (index.html) Web <ol> </ol> <li> </li> 5.3 index.html Web PHP <?php phpinfo(); *1 Web URL Web

5.4 HTML PHP 61?> 3 PHP (phpinfo.php) index.html http://web / /phpinfo.php 5.4 PHP PHP Web 5.4 phpinfo.php 5.4 HTML PHP HTML (form) ( Web ) GET (URL ) POST

62 5 PHP Web (URL ) <form action=" " method="get POST "> <input type="text" name="a" /> <input type="text" name="b" /> <input type="text" name="c" /> <input type="submit" /> </form> 5.5 Submit Web ( Apache ) action CGI QUERY STRING (PHP $ENV[ QUERY_STRING ] ) CGI a, b, c (name ) 32, 32, 23 a=32&b=32&c=23 = & & a=32, b=32, c=23 = 32, 32, 23 PHP Web (Apache) PHP PHP

5.4 HTML PHP 63 GET $_GET[ name ] POST $_POST[ name ] C Perl Web Web 5.4.1 quadratic eq.html 2 Web a, b, c quadratic eq.html (body ) <h1>2 </h1> <form action="quadratic_eq_solve.php" method="get"> <input type="text" name="a" /> * xˆ2 + <input type="text" name="b" /> * x + <input type="text" name="c" /> = 0 <br /> <input type="submit" value="2 " /> <input type="reset" value=" " /> </form> Web ( 5.6 ) 5.4.2 action PHP Web PHP HTML <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>solutions of Quadratic Equation</title> </head> <body> <h1>2 </h1> <?php PHP?>

64 5 PHP Web <p><a href="quadratic_eq.html"> </a></p> </body> </html> HTML PHP <?php?> PHP.php 5.4.3 HTML PHP quadratic eq.html action PHP quadratic eq solve.php HTML PHP quadratic eq.php quadratic eq solve.php 4: echo "a = "; $a = trim(fgets(stdin)); 5: echo "b = "; $b = trim(fgets(stdin)); 6: echo "c = "; $c = trim(fgets(stdin)); input 10: $a = $_GET[ a ]; 11: $b = $_GET[ b ]; 12: $c = $_GET[ c ]; qudratic eq.html 5.6 O.K. HTML, PHP B A +PHP

5.5 PHP HTML 65 5.6 2 5.5 PHP HTML HTML + PHP 2 PHP (quadratic eq sigle.php) <h1>2 ( + PHP)</h1> <form method="get"> </form> <?php // if(isset($_get[ a ]) && isset($_get[ b ]) && isset($_get[ c ])) { 2 PHP }?> <p><a href="index.html"> </a></p> action ( quadratic eq single.php) submit

66 5 PHP Web isset C quadratic eq single.php 5.6 PHP vs. C C PHP 1: <?php 2: // check dimension 3: if($argc <= 1) 4: { 5: echo "Usage: ". $argv[0]. " [dimension] Y=n"; 6: return; 7: } 8: 9: // input dimension 10: $dim = $argv[1]; 11: printf("dimension = %dy=n", $dim); 12: 13: // initialize 14: $mat_a = array($dim, $dim); 15: $vec_b = array($dim); 16: $vec_c = array($dim); 17: 18: // mat_a[i][j] = i + j + 1 19: for($i = 0; $i < $dim; $i++) 20: { 21: for($j = 0; $j < $dim; $j++) 22: $mat_a[$i][$j]= (double)($i + $j + 1); 23: } 24: 25: // vec_b[i] = dim - i 26: for($i = 0; $i < $dim; $i++) 27: $vec_b[$i] = (double)($dim - $i); 28: 29: // vec_c := mat_a * vec_b 30: $stime = microtime(true); // float 31: for($i = 0; $i < $dim; $i++)

5.6 PHP vs. C 67 32: { 33: $vec_c[$i] = 0.0; 34: for($j = 0; $j < $dim; $j++) 35: $vec_c[$i] += $mat_a[$i][$j] * $vec_b[$j]; 36: } 37: $etime = microtime(true); 38: 39: 40: // print vec_c 41: for($i = 0; $i < $dim; $i++) 42: printf("vec_c[%d] = %fy=n", $i, $vec_c[$i]); 43: 44: 45: printf("execution time: %f [seconds]y=n", $etime - $stime); 46: 47: // free 48: unset($mat_a); 49: unset($vec_b); 50: unset($vec_c); 51:?> C (matmul.c) $./matmul 100 Dimension = 100 Clock number per second: 100 (clocks/sec) Run Time (Clock) : 0 Run Time (Second) : 0.000000 System Time (Second): 0.000000 User Time (Second) : 0.000000 $./matmul 200 Dimension = 200 Clock number per second: 100 (clocks/sec) Run Time (Clock) : 0 Run Time (Second) : 0.000000 System Time (Second): 0.000000 User Time (Second) : 0.000000 *2 PHP $ php matmul.php 100 ( ) Execution time: 0.004659 [seconds] $ php matmul.php 200 ( ) Execution time: 0.018426 [seconds] *2 Intel Core i7 820 + CentOS 5.5 x86 64

68 5 PHP Web E matmul.php (HTML HTML ) 5 PHP HTML GET POST PHP HTML PHP