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

技術書紹介 パーフェクトPHP

46d57e2c568a65ade212f56539687bc2?s=47 ikuwow
July 08, 2015

技術書紹介 パーフェクトPHP

46d57e2c568a65ade212f56539687bc2?s=128

ikuwow

July 08, 2015
Tweet

Transcript

  1. ٕज़ॻ঺հɿ ύʔϑΣΫτPHP 2015/07/08 @ikuwow

  2. ࣗݾ঺հ • ग़઒ز෉ • ϚΠϒʔϜɿReact.js • ޷͖ͳ໺ࡊ ωΪ @ikuwow

  3. ຊͷ֓ཁ • 2010೥ॳ൛ୈ1࡮ൃߦ • ݁ߏްͯ͘ॏ͍ • PHPͷਓʹฉ͘ͱ͍͍ͩͨ࣋ͬ ͯΔ or ಡΜͩ͜ͱ͋Δ

    • ର৅ಡऀ͸தڃऀҎ্ʢPHPͰ ೔ৗతʹ։ൃΛ͖ͯͨ͠ਓ or ଞͷݴޠΛ࢖͍͜ͳ͍ͯ͠Δ͕ PHPͷ͜ͱΛΑ͘஌Βͳ͍ਓʣ
  4. ʮPHP͸CݴޠͰهड़͞Ε͍ͯ ΔͨΊɺCݴޠ͕Θ͔Βͳ͍ͱ ཧղ͢Δ͜ͱ΋೉͍͠Ͱ͠ΐ͏ʯ ʘ·͡Ͱʗ ʢୈҰষ ίϥϜʣ

  5. ໨࣍ • ୈ1෦ PHPͷ֓ཁ • ୈ2෦ PHPͷݴޠ࢓༷ • ୈ3෦ ࣮ફWebΞϓϦέʔγϣϯ

    • ୈ4෦ PHPηΩϡϦςΟ • ୈ5෦ ςΫχΧϧͳPHPͷ׆༻ ͕͜͜ ໘ന͍
  6. ʮୈ3෦ ࣮ફWebΞϓϦέʔ γϣϯʯ͕͍͢͝ • ୈ6ষ ࣮ફWebΞϓϦέʔγϣϯ • ୈ7ষ ϑϨʔϜϫʔΫʹΑΔޮ཰తͳ։ൃ •

    ୈ8ষ ϛχϒϩάΞϓϦέʔγϣϯ։ൃ DB࢖ͬͨ؆୯ͳΞϓϦέʔγϣϯ࡞੒ MVCϑϨʔϜϫʔΫͷ࡞੒ ʂʁ ϑϨʔϜϫʔΫΛ࢖ͬͨϛχϒϩά։ൃ ʂʁ
  7. MVCϑϨʔϜϫʔΫΛ࡞Δ • ClassLoader, Controller, RouterΫϥεͳ ͲΛόονϦ࡞Γ͜Ή • ࣍ͷষͰϑϨʔϜϫʔΫΛར༻ͯ͠ϛχ ϒϩάΞϓϦέʔγϣϯΛ࡞Δ <?php

    class ClassLoader { protected $dirs; public function register() { spl_autoload_register(array($this, 'loadClass')); } public function registerDir($dir) { $this->dirs[] = $dir; } public function loadClass($class) { foreach ($this->dirs as $dir) { $file = $dir . '/' . $class . '.php'; if (is_readable($file)) { require $file; return; } } } }
  8. ͨΊʹͳΔ͜ͱ • ੜPHPͱϑϨʔϜϫʔΫͷ͕ؒΘ͔Δʂ
 => ϧʔςΟϯά͔Β֤छΦϒδΣΫτΛखΛಈ͔ ͠ͳ͕Β࡞Δ͜ͱͰMVCϑϨʔϜϫʔΫͷཧղ͕ ਂ·Δ • ॳ৺ऀΛ୤ͨ͠Ϩϕϧͷਓ͕ؒҧ͕͑ͪͳ࢓༷Λ த৺ʹઆ໌͞Ε͍ͯΔʢ

    ‘0’ == ‘0.0’ ͕trueʹͳ ΔɺͳͲʣ
  9. ͦͷଞΑ͍ͱ͜Ζ • ηΩϡϦςΟʹଟ͘ϖʔδΛׂ͍͍ͯΔ • php.iniͷσΟϨΫςΟϒҰཡ • PHPͷϏϧυΦϓγϣϯҰཡ
 —with-xml, —enable-soap •

    Ҏ֎ͳݴޠ࢓༷ʹ஫໨ͨ͠આ໌
 ʢ ‘0’ == ‘0.0’ ͕trueʹͳΔɺͳͲʣ
  10. ಡΉͱ͍͍ਓ Ͳ͔͜Ͱݟֶͨशۂઢ 1)1ͷ࣮ྗ ֶश࣌ؒ ͍֮ࣗͯ͠Δ࣮ྗ ࣮ࡍͷ࣮ྗ աڈʹʮPHP͙Β͍Ͱ͖·͢Αʯͱ ΄͍͍ͯͨࣗ͟෼ΛռΊɺਅͷPHPerΛ໨ࢦͨ͢ΊͷҰ࡭

  11. ·ͱΊ • MVCϑϨʔϜϫʔΫΛ࡞Δষʹ஫໨ • ࣗ෼ͷֶशϑΣʔζor࣮ྗʹݟ߹͍ͬͯΔͱ ຊ౰ʹ໘ന͍ຊ • ͜ΕΛखΛಈ͔͠ͳ͕ΒશͯಡΈ͖ͬͯཧղ ͨ͠ΒʮPHPͰ͖Δʯͱࣗ৴Λ΋ͬͯݴ͑Δ ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠