SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast greedyman's Avatar
    Join Date
    Jun 2012
    Location
    New World
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How to realize class without include?

    Assuming that I have a code like this:

    <?php
    class user_controller extends controller {

    }
    ?>
    controller is a class, and putted in somewhere. How do I do? Don't need include to use this class as below:

    PHP Code:
    <?php
        
    include('somewhere/controller.php');

        class 
    user_controller extends controller {
            
        }
    ?>

  2. #2
    SitePoint Wizard bronze trophy Jeff Mott's Avatar
    Join Date
    Jul 2009
    Posts
    1,311
    Mentioned
    19 Post(s)
    Tagged
    1 Thread(s)
    "First make it work. Then make it better."

  3. #3
    SitePoint Enthusiast greedyman's Avatar
    Join Date
    Jun 2012
    Location
    New World
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks so much!

  4. #4
    Team SitePoint
    Join Date
    Feb 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Apart from that, you might want to have a look at libraries that provide class loading for you and make it easy to load classes from other projects, too. See http://getcomposer.org/doc/01-basic-...md#autoloading or http://symfony.com/doc/2.0/components/class_loader.html for example.

  5. #5
    SitePoint Enthusiast greedyman's Avatar
    Join Date
    Jun 2012
    Location
    New World
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by msauter View Post
    Apart from that, you might want to have a look at libraries that provide class loading for you and make it easy to load classes from other projects, too. See http://getcomposer.org/doc/01-basic-...md#autoloading or http://symfony.com/doc/2.0/components/class_loader.html for example.
    Thanks. It's very helpful!


Bookmarks

Posting Permissions

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