SlideShare a Scribd company logo
1 of 37
Download to read offline
PHP
                Club86 Startup School




11   7   23
PHP
              • PHP
              •
              •
              •
              • CakePHP
11   7   23
PHP




11   7   23
PHP?
                     PHP = PHP: HyperText Preprocessor

                                 HTML


              •
              • Web
                  → Web



11   7   23
PHP Web
                               PHP


                     Web
          PHP
              PHP              Web
                         PHP
               PHP



                     PHP


11   7   23
PHP Web
                                   PHP


                     Web
          PHP
              PHP                  Web
                         PHP
               PHP
                               PHP PHP

                     PHP


11   7   23
PHP
              PHP
                      PHP


                PHP
                                  PHP




                        HTML

11   7   23
•
                  •
              •
                  •
              •
                  •

11   7   23
1.                            1.

              2.                            2.

              3.



          C        C          Objective-C        PHP Perl Ruby
                       Java    C             Python JavaScript
11   7   23
PHP

              • <?php ... ?>                         PHP


               •
                    <h1>              <?php echo "    "; ?>    </h1>




                               <h1>                    </h1>




11   7   23
11   7   23
•
                  •$
                                               $a
                  •1   a-z, A-Z, _

                  •2        a-z, A-Z, 0-9, _




11   7   23
•   boolean            $a = true;
                                     $b = false;




              •   integer    float
                                     $a = 10;
                                     $b = 1.5;




              •     string
                                     $a = "ABC";
                                     $b = '   ';




11   7   23
•             array
                                       $a = array("      ", 35, "(    )   ");
                                       echo $a[2];    // (    )



                                       $b = array(
                  key => value         !   "name" => "       ",
                                       !   "age" => 35,

                  key                  !
                                       );
                                           "company" => "(        )   "

                        0, 1, 2, ...   echo $b["name"];      //




11   7   23
y = f(x)
                             x         y


                         cos θ = b/h
                 cos(π/4) = √2/2



11   7   23
PHP                      echo strlen("ABC");
                                       echo date("Y/m/d");
                                       echo ceil(4.3);




                         or
              function        function hello($x) {
                              ! return $x."             ";
                              }
                              echo hello("   ");

11   7   23
11   7   23
11   7   23
•
                  $str = "     ";
                  echo $str;




11   7   23
if
                                           if ( X ) {

              •   X                A       !
                                           }
                                               A ;




              •   X                A       if ( X ) {
                                           !   A ;
                                           } else {
                           B               !   B ;
                                           }



              •   X                A       if ( X ) {
                                           !   A ;
                                           } elseif ( Y ) {
                       Y               B   !   B ;
                                           } else {
                               C           !
                                           }
                                               C ;




11   7   23
switch
                                                              switch ($a) {

              • $a    X               A                $a Y   !
                                                              !
                                                                  case X:
                                                                  !   A ;
                                                              !   !   break;
                          Z               B             $a    !   case Y:
                                                              !   case Z:
                                                              !   !   B ;
                                              C               !   !   break;
                                                              !   default:
                                                              !   !   C ;
                                                              }



                              break               {}




11   7   23
while

              •                $i = 0;
                               while ($i < 10) {
                               !   echo $i;
                               !   $i++;

                  •0
                               }
                          9


                   do while

              • while          $i = 0;
                               do {
                               !   echo $i;
                               !   $i++;

              •
                               } while ($i < 10);




11   7   23
for

              •             for ($i = 0; $i < 10; $i++) {
                            !   echo $i;
                            }




                  foreach

              •             $data = array("A", "B", "C");
                            foreach ($data as $d) {
                            !   echo $d;
                            }




11   7   23
11   7   23
•
              •
                  •   3




              •       PHP

11   7   23
•
                  •
                  •
                      •

11   7   23
•
              • tr
              •
                • td
                •0     6



11   7   23
•
              •
                  •   tr

                  •                  td
              •
                  •        tr

                  •   td

                  •
                  •   td

                  •        tr

              •
                  •             td
                  •   tr

11   7   23
$week = array("   ", "   ", "   ", "   ", "   ", "   ", "   ");
              echo "<tr>";
              for ($i = 0; $i < count($week); $i++) {
              !   echo "<td>";
              !   switch ($i) {
              !   !   case 0:
              !   !   !   echo '<font color="red">'.$week[$i].'</font>';
              !   !   !   break;
              !   !   case 6:
              !   !   !   echo '<font color="blue">'.$week[$i].'</font>';
              !   !   !   break;
              !   !   default:
              !   !   !   echo $week[$i];
              !   }
              !   echo "</td>";
              }
              echo "</tr>";



11   7   23
$wnum = date('w', mktime(0, 0, 0, date('m'), 1, date('Y')));
              if ($wnum != 0) {
              !   echo '<tr>';
              !   for ($i = 0; $i < $wnum; $i++) {
              !   !   echo '<td> </td>';
              !   }
              }




11   7   23
$today = date('d');
              $lastday = date('t');
              for ($i = 1; $i <= $lastday; $i++) {
              !    if ($wnum == 0) {
              !    !    echo '<tr>';
              !    }
              !    if ($i == $today) {
              !    !    echo '<td style="background-color:#ffff00;">';
              !    } else {
              !    !    echo '<td>';
              !    }
              !    switch ($wnum) {
              !    !    case 0:
              !    !    !    echo '<font color="red">'.$i.'</font>';
              !    !    !    break;
              !    !    case 6:
              !    !    !    echo '<font color="blue">'.$i.'</font>';
              !    !    !    break;
              !    !    default:
              !    !    !    echo $i;
              !    }
              !    echo '</td>';
              !    if ($wnum == 6) {
              !    !    echo '</tr>';
              !    }
              !    $wnum = ($wnum + 1) % 7;
              }



11   7   23
if ($wnum != 0) {
              !   for ($i = $wnum; $i <= 6; $i++) {
              !   !   echo '<td> </td>';
              !   }
              !   echo '</tr>';
              }




11   7   23
CakePHP




11   7   23
URL
                                  http://localhost/[                   ]/
                                      [            ]/[                 ]

              :[   ]_controller.php          :[          ]Controller




11   7   23
URL
                            http://localhost/[     ]/
                            [                ]/[   ]



              index




11   7   23
DB
               ※




11   7   23
11   7   23

More Related Content

Recently uploaded

محاضرات الاحصاء التطبيقي لطلاب علوم الرياضة.pdf
محاضرات الاحصاء التطبيقي لطلاب علوم الرياضة.pdfمحاضرات الاحصاء التطبيقي لطلاب علوم الرياضة.pdf
محاضرات الاحصاء التطبيقي لطلاب علوم الرياضة.pdfKhaled Elbattawy
 
Castellà parelles 2n - Abril i Irina.pdf
Castellà parelles 2n - Abril i Irina.pdfCastellà parelles 2n - Abril i Irina.pdf
Castellà parelles 2n - Abril i Irina.pdfErnest Lluch
 
Català Individual 3r - Víctor.pdf JOCS FLORALS
Català Individual 3r - Víctor.pdf JOCS FLORALSCatalà Individual 3r - Víctor.pdf JOCS FLORALS
Català Individual 3r - Víctor.pdf JOCS FLORALSErnest Lluch
 
RESOLUCION DEL SIMULACRO UNMSM 2023 ii 2.pptx
RESOLUCION DEL SIMULACRO UNMSM 2023 ii 2.pptxRESOLUCION DEL SIMULACRO UNMSM 2023 ii 2.pptx
RESOLUCION DEL SIMULACRO UNMSM 2023 ii 2.pptxscbastidasv
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning ProjectNuckles
 
Català parelles 3r - Emma i Ariadna (1).pdf
Català parelles 3r - Emma i Ariadna (1).pdfCatalà parelles 3r - Emma i Ariadna (1).pdf
Català parelles 3r - Emma i Ariadna (1).pdfErnest Lluch
 
Saunanaine_Helen Moppel_JUHENDATUD SAUNATEENUSE JA LOODUSMATKA SÜNERGIA_strat...
Saunanaine_Helen Moppel_JUHENDATUD SAUNATEENUSE JA LOODUSMATKA SÜNERGIA_strat...Saunanaine_Helen Moppel_JUHENDATUD SAUNATEENUSE JA LOODUSMATKA SÜNERGIA_strat...
Saunanaine_Helen Moppel_JUHENDATUD SAUNATEENUSE JA LOODUSMATKA SÜNERGIA_strat...Eesti Loodusturism
 

Recently uploaded (8)

محاضرات الاحصاء التطبيقي لطلاب علوم الرياضة.pdf
محاضرات الاحصاء التطبيقي لطلاب علوم الرياضة.pdfمحاضرات الاحصاء التطبيقي لطلاب علوم الرياضة.pdf
محاضرات الاحصاء التطبيقي لطلاب علوم الرياضة.pdf
 
Castellà parelles 2n - Abril i Irina.pdf
Castellà parelles 2n - Abril i Irina.pdfCastellà parelles 2n - Abril i Irina.pdf
Castellà parelles 2n - Abril i Irina.pdf
 
Català Individual 3r - Víctor.pdf JOCS FLORALS
Català Individual 3r - Víctor.pdf JOCS FLORALSCatalà Individual 3r - Víctor.pdf JOCS FLORALS
Català Individual 3r - Víctor.pdf JOCS FLORALS
 
RESOLUCION DEL SIMULACRO UNMSM 2023 ii 2.pptx
RESOLUCION DEL SIMULACRO UNMSM 2023 ii 2.pptxRESOLUCION DEL SIMULACRO UNMSM 2023 ii 2.pptx
RESOLUCION DEL SIMULACRO UNMSM 2023 ii 2.pptx
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Català parelles 3r - Emma i Ariadna (1).pdf
Català parelles 3r - Emma i Ariadna (1).pdfCatalà parelles 3r - Emma i Ariadna (1).pdf
Català parelles 3r - Emma i Ariadna (1).pdf
 
Saunanaine_Helen Moppel_JUHENDATUD SAUNATEENUSE JA LOODUSMATKA SÜNERGIA_strat...
Saunanaine_Helen Moppel_JUHENDATUD SAUNATEENUSE JA LOODUSMATKA SÜNERGIA_strat...Saunanaine_Helen Moppel_JUHENDATUD SAUNATEENUSE JA LOODUSMATKA SÜNERGIA_strat...
Saunanaine_Helen Moppel_JUHENDATUD SAUNATEENUSE JA LOODUSMATKA SÜNERGIA_strat...
 
Díptic IFE (2) ifeifeifeife ife ife.pdf
Díptic IFE (2)  ifeifeifeife ife ife.pdfDíptic IFE (2)  ifeifeifeife ife ife.pdf
Díptic IFE (2) ifeifeifeife ife ife.pdf
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Club86 基礎講義「PHPを使おう」

  • 1. PHP Club86 Startup School 11 7 23
  • 2. PHP • PHP • • • • CakePHP 11 7 23
  • 3. PHP 11 7 23
  • 4. PHP? PHP = PHP: HyperText Preprocessor HTML • • Web → Web 11 7 23
  • 5. PHP Web PHP Web PHP PHP Web PHP PHP PHP 11 7 23
  • 6. PHP Web PHP Web PHP PHP Web PHP PHP PHP PHP PHP 11 7 23
  • 7. PHP PHP PHP PHP PHP HTML 11 7 23
  • 8. • • • • • 11 7 23
  • 9. 1. 1. 2. 2. 3. C C Objective-C PHP Perl Ruby Java C Python JavaScript 11 7 23
  • 10. PHP • <?php ... ?> PHP • <h1> <?php echo " "; ?> </h1> <h1> </h1> 11 7 23
  • 11. 11 7 23
  • 12. •$ $a •1 a-z, A-Z, _ •2 a-z, A-Z, 0-9, _ 11 7 23
  • 13. boolean $a = true; $b = false; • integer float $a = 10; $b = 1.5; • string $a = "ABC"; $b = ' '; 11 7 23
  • 14. array $a = array(" ", 35, "( ) "); echo $a[2]; // ( ) $b = array( key => value ! "name" => " ", ! "age" => 35, key ! ); "company" => "( ) " 0, 1, 2, ... echo $b["name"]; // 11 7 23
  • 15. y = f(x) x y cos θ = b/h cos(π/4) = √2/2 11 7 23
  • 16. PHP echo strlen("ABC"); echo date("Y/m/d"); echo ceil(4.3); or function function hello($x) { ! return $x." "; } echo hello(" "); 11 7 23
  • 17. 11 7 23
  • 18. 11 7 23
  • 19. $str = " "; echo $str; 11 7 23
  • 20. if if ( X ) { • X A ! } A ; • X A if ( X ) { ! A ; } else { B ! B ; } • X A if ( X ) { ! A ; } elseif ( Y ) { Y B ! B ; } else { C ! } C ; 11 7 23
  • 21. switch switch ($a) { • $a X A $a Y ! ! case X: ! A ; ! ! break; Z B $a ! case Y: ! case Z: ! ! B ; C ! ! break; ! default: ! ! C ; } break {} 11 7 23
  • 22. while • $i = 0; while ($i < 10) { ! echo $i; ! $i++; •0 } 9 do while • while $i = 0; do { ! echo $i; ! $i++; • } while ($i < 10); 11 7 23
  • 23. for • for ($i = 0; $i < 10; $i++) { ! echo $i; } foreach • $data = array("A", "B", "C"); foreach ($data as $d) { ! echo $d; } 11 7 23
  • 24. 11 7 23
  • 25. • • 3 • PHP 11 7 23
  • 26. • • • 11 7 23
  • 27. • tr • • td •0 6 11 7 23
  • 28. • • tr • td • • tr • td • • td • tr • • td • tr 11 7 23
  • 29. $week = array(" ", " ", " ", " ", " ", " ", " "); echo "<tr>"; for ($i = 0; $i < count($week); $i++) { ! echo "<td>"; ! switch ($i) { ! ! case 0: ! ! ! echo '<font color="red">'.$week[$i].'</font>'; ! ! ! break; ! ! case 6: ! ! ! echo '<font color="blue">'.$week[$i].'</font>'; ! ! ! break; ! ! default: ! ! ! echo $week[$i]; ! } ! echo "</td>"; } echo "</tr>"; 11 7 23
  • 30. $wnum = date('w', mktime(0, 0, 0, date('m'), 1, date('Y'))); if ($wnum != 0) { ! echo '<tr>'; ! for ($i = 0; $i < $wnum; $i++) { ! ! echo '<td> </td>'; ! } } 11 7 23
  • 31. $today = date('d'); $lastday = date('t'); for ($i = 1; $i <= $lastday; $i++) { ! if ($wnum == 0) { ! ! echo '<tr>'; ! } ! if ($i == $today) { ! ! echo '<td style="background-color:#ffff00;">'; ! } else { ! ! echo '<td>'; ! } ! switch ($wnum) { ! ! case 0: ! ! ! echo '<font color="red">'.$i.'</font>'; ! ! ! break; ! ! case 6: ! ! ! echo '<font color="blue">'.$i.'</font>'; ! ! ! break; ! ! default: ! ! ! echo $i; ! } ! echo '</td>'; ! if ($wnum == 6) { ! ! echo '</tr>'; ! } ! $wnum = ($wnum + 1) % 7; } 11 7 23
  • 32. if ($wnum != 0) { ! for ($i = $wnum; $i <= 6; $i++) { ! ! echo '<td> </td>'; ! } ! echo '</tr>'; } 11 7 23
  • 33. CakePHP 11 7 23
  • 34. URL http://localhost/[ ]/ [ ]/[ ] :[ ]_controller.php :[ ]Controller 11 7 23
  • 35. URL http://localhost/[ ]/ [ ]/[ ] index 11 7 23
  • 36. DB ※ 11 7 23
  • 37. 11 7 23