Results 1 to 1 of 1

Thread: เขียน PHP แบบ OOP: ตอนการสร้าง Class

  1. #1
    Junior Member
    Join Date
    Jul 2010
    Posts
    11


    เขียน PHP แบบ OOP: ตอนการสร้าง Class

    เนื่องจาก ผม เคยพัฒนาระบบ และ เว็บไซต์ ด้วยภาษา php แบบ โครงสร้าง พบว่า พอเวลาแก้โค๊ดบางส่วนทำไม กระทบต่อโค๊ดส่วนอื่นด้วย อีกทั้งในการ develop ยิ่งเขียนโค๊ดยิ่งมากบรรทัด ถ้าหากผมไม่มี tool ในการเขียน ลำบากแน่

    ผม เลยสนใจ เปลี่ยน แนวการเขียนภาษา php ในแนว โครงสร้าง มา แบบเชิงวัตถุ หรือเรา จะเรียกว่า OOP ครับ

    การสร้าง คลาส ใน php

    นี้ตัวอย่างการสร้างคลาสใน php

    // File : Human.php
    <?
    class Human // Class Name is Human
    {
    function talk() // Talk Function
    {
    print "Hi";
    }

    }

    // TestClient.php is a Test File.

    <?

    include("Human.php");
    $human = new Human();
    $human->talk();
    ?>


    ผลลัพธ์
    -------------

    Hi

    เบื้องต้น ผมได้เท่านี้ หากใครมีอะไรแนะนำบอกได้นะครับ

    Ref: https://sites.google.com/site/oopinphp/
    Last edited by doing; 15-08-2010 at 09:36 PM.

Similar Threads

  1. PHP Class AJAX
    By gooeasy in forum PHP,ASP,Javascript, Html
    Replies: 0
    Last Post: 02-03-2008, 02:57 AM
  2. ยกระดับ Class
    By kamikaze in forum Newbie / Starter Hacker
    Replies: 1
    Last Post: 31-03-2007, 10:22 PM
  3. How to Decompile .class
    By asylu3 in forum Java
    Replies: 0
    Last Post: 17-06-2003, 07:58 PM

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •