Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PHPカンファレンス2016 初心者セッション

Hideo Kashioka
November 03, 2016

PHPカンファレンス2016 初心者セッション

Hideo Kashioka

November 03, 2016
Tweet

More Decks by Hideo Kashioka

Other Decks in Technology

Transcript

  1. PHPͱ͸ PHP is a popular general-purpose scripting language that is

    especially suited to web development. Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world. http://php.net/ΑΓ
  2. LAMP LAPP LEMP Linux Apache MySQL PHP Linux Apache Postgre

    PHP Linux Nginx MariaDB PHP ݺͼํ͸ OS+Web Server+Database+Script
  3. <?php $a = 1; $b = 2; echo $a +

    $b; echo '<br>'; echo $a . $b; http://localhost:8888/sample4.php
  4. <?php $a = "phpcon"; $b = 2015; echo $a .

    "/" . $b + 1; http://localhost:8888/sample2.php
  5. <div> <?php if($a): ?> <div id='a'>ຬͨ͢</div> <?php else: ?> <div

    id=''>ຬͨ͞ͳ͍</div> <?php endif; ?> </div> http://localhost:8888/div.php
  6. htmlspecialchars <?php $new ="<a href='test'>Test</a>"; echo $new; <?php $new ="<a

    href='test'>Test</a>"; echo htmlspecialchars($new,ENT_QUOTES); http://localhost:8888/sample3.php
  7. ௐ΂ͯΈͨΒ fopen — ϑΝΠϧ·ͨ͸ URL ΛΦʔϓϯ͢Δ whileϧʔϓ͸ɺPHPͰ࠷΋؆୯ͳλΠϓͷϧʔϓͰ͢ɻ count — ม਺ʹؚ·ΕΔ͢΂ͯͷཁૉɺ

    ͋Δ͍͸Φϒ δΣΫτʹؚ·ΕΔԿ͔ͷ਺Λ਺͑Δ fclose — Φʔϓϯ͞ΕͨϑΝΠϧϙΠϯλΛΫϩʔζ͢Δ ͜ΕΛ౿·͑ͯ
  8. <table border=1> <?php ini_set('display_errors',1); $row = 1; if (($handle =

    fopen("POP.csv", "r")) !== FALSE) { while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { if($data[3]) { echo "<tr>"; echo "<td>" . htmlspecialchars($data[3],ENT_QUOTES) ."</td><td>" . htmlspecialchars($data[4],ENT_QUOTES) . "</td>"; echo "</tr>"; } } fclose($handle); } ?> </table>